Concept clusters
Related ideas that live chapters apart, pulled onto one page — every way to own memory, every container and when to pick it, and more.
Every way to share data
Move it, copy it, lend it with & or &mut, clone it, count it with Rc or Arc, or send it down a channel. Who owns the value decides which.
16 concepts →
Every way to handle a failure
panic!, Option, Result, unwrap and expect, ?, your own error enum, Box
19 concepts →
Every way to choose behaviour by type
Generics, impl Trait, dyn Trait and enums. Four ways for one piece of code to work with several types, and what each costs.
14 concepts →
Every way to repeat work over a collection
loop, while, for, iterator adapters and consumers, collect, your own Iterator, and par_iter. Which one reads best for the job.
13 concepts →
Every pointer type
&T, &mut T, slices, Box, Rc, Arc, Weak, Cell and RefCell, and raw pointers. What each one owns, who can change the value, and what it costs.
16 concepts →
Every way to run things at the same time
Threads, scoped threads, channels, Arc and Mutex, atomics, rayon, async tasks and spawn_blocking. Which one fits the work you have.
18 concepts →
Every way to organize code
Functions, modules, files, visibility, library and binary crates, workspaces and features. Where each boundary goes and what it buys you.
14 concepts →
Every way to convert between types
as, From and Into, TryFrom and TryInto, parse and FromStr, Display and to_string, and the string conversions. Which ones can fail, and which ones lose data quietly.
14 concepts →
Every lifetime you'll meet
Elided lifetimes, named 'a parameters, references in structs, 'static, lifetime bounds, higher-ranked bounds and variance. What each annotation says, and what fixes a lifetime error.
14 concepts →
Every way to test Rust code
Unit tests, integration tests, doc tests, table tests, property tests, test doubles, fuzzing, Miri, and tests for async code and web services. What each kind catches.
15 concepts →
Every way to talk to the operating system
Files, paths and directories, arguments and environment variables, standard streams, child processes, signals, sockets, and calling the OS directly. The standard library door for each.
17 concepts →
Every unsafe superpower
The five operations unsafe unlocks (raw pointer dereference, unsafe calls, unsafe traits, mutable statics, union fields), the contracts that go with them, and the tools that check your work.
13 concepts →
Every way to save and send structured data
serde with JSON, TOML, CSV or a binary format, attributes to match someone else's shape, custom and validated serialization, and reading data you don't trust.
13 concepts →
Every way to build and ship a Rust program
Debug and release profiles, cross-compilation, static and dynamic linking, containers, per-platform packages, and CI. Getting from cargo build to something other people run.
13 concepts →