# Introducing Rust During all the sessions, I talked about quality in terms of code validation: you write tests to check your program; you build Docker images to provide everybody with a packaged environment. But, quality also comes with the programming language itself. During the last years, Rust emerged as the programming language to build (more) robust, safe software systems (compared to C++ and C). Mozilla created Rust to replace C++ in the development of Firefox. Their goal is to have a language more focused on memory access and errors. Rust has no garbage collector, compiles to native code. Rust may make C++ and C deprecated during the coming decade(s). ## Installation Rust installer: https://rustup.rs Then, `rustup default stable` Then, install the tutorials: `curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install.sh | bash` You can also run Rust code directly on: https://play.rust-lang.org/ ## Running Rustlings, the Rust tutorials `cd rustlings` Finally run to launch the exercises: `~/.cargo/bin/rustlings watch` Follow the given instructions while editing `rs` files with a text editor. Focus on code quality: - `variables4.rs`, what is the difference between mutability and immutability? Which relation with code safety? - You can skip the exercises on primitive types (by removing `// I AM NOT DONE`) as these are very simple and not related to the course. - `vecs2.rs`. Rust has pointers as in C++/C. Why the second function (the one that uses `map`) should be used instead of the first one? (still related to mutability) - `move_semantics1.rs`. As suggested by the *hint* command, why the code does not compile if you put `println!("{} has length {} content `{:?}`", "vec0", vec0.len(), vec0);` after the call to `fill_vec`? For that read: https://doc.rust-lang.org/stable/rust-by-example/scope/move.html On this point Rust strongly differs from C++/C/Java