A quick-reference guide for Rust programming
Rust is a systems programming language focused on safety, speed, and concurrency — without a garbage collector. It prevents memory bugs at compile time through its ownership model.
Edition Rust 2021 Paradigm Systems, Functional Typing Static, Strong
&T (immutable) / &mut T (mutable)let x = 5;let mut x = 5;i32, u64, f64, bool, char
String, Vec<T>, Box<T>if / else if / else (expressions, not statements)loop, while, for x in itermatch — exhaustive pattern matchingOption<T> — Some(T) | None (no null)Result<T, E> — Ok(T) | Err(E) for error handling? operator for early error returnmatch with guards and destructuring| Category | Crate / Tool |
|---|---|
| Web | Actix-web, Axum, Rocket |
| Async | Tokio, async-std |
| Serialization | serde, serde_json |
| CLI | clap, structopt |
| Testing | Built-in #[test], proptest |
| Build | Cargo (package manager + build tool) |
dyn Trait) vs genericsBox, Rc, Arc, RefCellSend + Sync traits