Rust guides
Every published Rust guide, newest first, with practical examples you can copy into your own project.
3,815 guides across 14 topics
Topics
Popular Rust guides
Most readLatest Rust guides
Page 2 of 2Rust Async Await: Futures, Pinning, and Tokio Task Execution
An async fn runs nothing until an executor polls it. Await points, Send bounds, blocking in a worker, cancellation and the runtime nesting panic.
Rust Concurrency: Spawning Threads, mpsc Channels, and Arc<Mutex<T>>
Ownership rules make data races a compile error. Sharing with Arc<Mutex>, sending with mpsc, and the lock ordering and sender-lifetime mistakes that hang.
Rust Structs and Enums: Tuple Structs, Methods, and Algebraic Data Types
Struct is and, enum is or. Newtypes that stop argument mix-ups, receivers that decide ownership, and state machines where illegal states cannot be built.
Rust Iterators and Closures: map, filter, and move Semantics
Iterators are lazy and monomorphised into loops. The three consumption forms, the Fn trait ladder, and why an adapter chain with no consumer does nothing.
Rust Smart Pointers: Box, Rc, Arc, and RefCell with Interior Mutability
Four pointers, four policies: single owner, shared single-thread, shared multi-thread, and a runtime borrow check. The cycles that leak and the panics that bite.
Rust Traits: Defining Interfaces, Default Methods, and Trait Bounds
Static dispatch versus dyn, associated types versus generic parameters, and the object-safety and orphan rules that decide what an API can express.
Rust Error Handling: Result, Option, unwrap, and the ? Operator
Errors are values. How ? converts between error types, when unwrap is honest, and the difference between absence and failure that Option erases.
Rust Pattern Matching: match Expressions, Guards, and if let Syntax
match is exhaustive and checked; guards are not. Destructuring, bindings with @, slice patterns, and the wildcard arm that quietly breaks when an enum grows.
Rust Lifetimes Explained: Annotations, Struct References, and Elision
Lifetimes describe relationships, not durations. The three elision rules, what 'static really means, and the two errors no annotation can fix.
Rust Ownership and Borrowing: Move Semantics and Borrow Checker Rules
One owner, either many readers or one writer. How moves differ from Copy, what NLL changed, and the four error codes that cover most borrow failures.