Getting started rust development
The sample is: rustup doc
in local
Environment setup
1# update the rust binary
2rustup update
3# uninstall the rust and rustup self
4rustup self uninstall
5
6rustc -V
7cargo -V
Basic commands
1rustc --version
2cargo --version
3
4# crate the cargo project
5cargo new exercise
6cd exercise
7cargo run
8
9# to fast check
10cargo check
11# build
12cargo build --release
13# to debug
14cargo run
15# to debug build
16cargo build
17# to fromat the code
18rustfmt ./src/main.rs
Launch the Comprehensive-rust
in local use the mdbook
This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
1# clone the repo to local
2git clone https://github.com/google/comprehensive-rust/
3cd comprehensive-rust
4
5# install tehse tools
6cargo install mdbook
7cargo install --locked mdbook-svgbob
8cargo install --locked mdbook-i18n-helpers
9cargo install --locked i18n-report
10cargo install --locked mdbook-linkcheck
11cargo install --locked --path mdbook-exerciser
12cargo install --locked --path mdbook-course
13
14mdbook test
15mdbook serve
Launch the rustlings
rustlings.cool
Small exercises to get you used to reading and writing Rust code!
1# install the rustlings
2cargo install rustlings
3# initialization and enter the directory
4rustlings init
5cd rustlings/
6rustlings
7
8# open the exercises in vscode
9cd rustlings/
10code .
Setup the 100-exercises-to-learn-rust
in local
- Clone the repo
git clone https://github.com/mainmatter/100-exercises-to-learn-rust.git
- Checkout
1cd 100-exercises-to-learn-rust
2git checkout -b my-solutions
- Installation the Workshop runntime
1cargo install --locked workshop-runner
2# enter the exercises folder
3cd exercises
4# open the project in vs code
5code ./01_intro/00_welcome
6# debug and complete the src/lib.rs
7# launch the workshop runtime
8wr