This is an introduction to features of Rust for experienced Java/C++ programmers, which aims to build up an indexable comprehension of Rust even though technical details are omitted.
- Strictly typed
- Strongly static
- Concurrent safe
-
environment setup
-
Linux and macOS
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Windows
download
rustup-init.exe
on https://www.rust-lang.org/learn/get-started -
Online playground(great for trying out but slow)
-
-
hello rust
Simply
cargo new <path>
For example,
cargo new my_fancy_project
with default crate name asmy_fancy_project
Then
cd
andcargo run
- Datatypes,
let
and static type inference - Control Flows
- How to define a type ("class")
- "method" and function definitions and restrictions
- how to define a trait ("interface")
- Closures - Anonymous Functions
- Generics
- References and lifetime
- Enums and Pattern Matching
- Error handling
- Safe concurrency
- Null-value Safety
- Mandatory error checking
- Blanket implementation of traits
- No global variables
unsafe
keyword- Full-fledge builtin testing and documentation support
- Favor composition over inheritance
- Favor constructors over default values
- True meta-programming with macros
toolchain management
- dependency management
- building, publishing and deployment management
- All-in-one official official learning website
- The book
- Rust by examples
- Core documentations
- Domain specific references
- webassambly book
- Rustonomicon - the book of dark magics
- Unstable book
- Vibrant, active and friendly community forum
- My posts in the forum that attract many discussions
- (Advertisement) My repo RustyOOPatterns
To build the book into web pages, you’ll need Rust and Cargo installed.
cd ./pre
cargo install mdbook
mdbook build