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 1 of 2Rust Pin and Unpin: Memory Pinning, Self-Referential Structs, and Futures
Why a future must not move after polling starts, what Unpin opts out of, and how Box::pin, pin! and map_unchecked_mut express that guarantee.
Rust Unsafe: Raw Pointers, FFI Bindings, and Soundness Invariants
What unsafe actually unlocks, the five soundness contracts behind raw pointers, and the FFI rules for repr(C), CString and unwinding.
Rust Arrays and Slices: Fixed Arrays, &[T] Fat Pointers, and DSTs
An array carries its length in its type; a slice carries it in the pointer. The split_at_mut, chunks and TryFrom patterns that follow from that.
Rust Testing: Unit Tests, Integration Tests, and Cargo Doc Tests
Three test kinds with three different visibility rules, plus the commands, attributes and doc-test fences that make cargo test useful.
Rust Serde: JSON Serialization, Derive Macros, and Field Attributes
Serde attributes decide the wire format: rename strategies, defaults, flatten, enum tags and custom codecs, plus the number and ordering traps.
Rust Macros: macro_rules! Patterns, Hygiene, and Procedural Macros
Matcher fragments, repetition, hygiene and the proc-macro crate. How to read a macro_rules! error and when a derive macro is the right tool.
Rust Strings Explained: &str vs String, UTF-8 Indexing, and Conversions
Why s[0] does not compile, why slicing can panic, and when a &str becomes an owned String. The UTF-8 rules behind every Rust string error.
Rust Collections: Vec, HashMap, BTreeMap, and the Entry API
Vec for sequences, HashMap for keyed lookup, BTreeMap for order. Where the Entry API removes a lookup, and why index removal is O(n).
Rust Modules and Crates: mod, pub Visibility, use Paths, and Workspaces
Modules decide privacy, crates decide compilation, workspaces decide sharing. The file layout, visibility levels and Cargo wiring that hold them together.
Rust Generics: Type Parameters, Where Clauses, and Monomorphization
How generics become zero-cost code, why where clauses are not cosmetic, and how monomorphization turns one function into many.