Examples from tutorial and other documentations of Rust.
Rust-examples is a repository to gather example codes from tutorial and other documentations of Rust into files, ready to compile.
Examples are tested with version 1.64.0 and 1.68.0-nightly.
what_it_looks_like.rs
, what_it_looks_like2.rs
, what_it_looks_like3.rs
tutorial-02_1-hello.rs
tutorial-03-syntax_basics.rs
tutorial-04_2-pattern-matching.rs
for
, while
, loop
): tutorial-04_3-loops.rs
tutorial-05_1-structs.rs
tutorial-05_2-enum.rs
tutorial-05_3-tuples.rs
tutorial-15-closure.rs
tutorial-16-methods.rs
tutorial-17-generics.rs
tutorial-tasks-02_1-communication.rs
tutorial-tasks-02_3-arc.rs
book-5-6-threads.rs
unittests.rs
phantom_type.rs
lang-interface.rs
lang-lambda.rs
lang-generics.rs
lang-overloading.rs
lang-pointers.rs
lang-question_mark.rs
api-collections-hashmap.rs
api-getopts.rs
api-rand.rs
api-std-from_str.rs
api-std-fs-file.rs
api-std-vec.rs
Makefile
to compile, run tests and run benchmarks.travis.yml
to add the repository to Travis CI and Rust CI
fibonacci.rs
date.rs
find_max.rs
inifile.rs
datumbazo2tbx.rs
design_pattern-decorator.rs
and design_pattern-decorator2.rs
design_pattern-strategy.rs
design_pattern-observer.rs
design_pattern-command.rs
design_pattern-state.rs
design_pattern-templatemethod.rs
design_pattern-chain_of_command.rs
design_pattern-visitor.rs
finite-state-machine.rs
You will need the version 1.64.0 of the rust compiler. If you encounter problems, make sure you have the right version before creating an issue.
The simplest way to build rust-examples is to do a clone and use make
to compile:
git clone https://github.com/eliovir/rust-examples
cd rust-examples
make
To run tests and benchmarks (benchmarks need Nightly):
make tests
make bench
To get help on commands:
make help
git clone https://github.com/eliovir/rust-examples
)git checkout -b my-new-feature
)make test
)git commit -am 'Add some feature'
)git push origin my-new-feature
)other projects have similar goals: providing Rust code snippets:
Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
These codes are distributed under the MIT license.
See LICENSE for details.