Install Rust, make your first project with cargo, print values with format strings, and learn to read a Rust compiler error line by line. The compiler often tells you the fix.
Rust variables can’t change unless you say mut, every value has a fixed type, and an integer that overflows stops a debug build. This part covers let, mut, shadowing, const, the number types, char, as casts and overflow.
In Rust, blocks, if and even loop produce values. This part covers functions, return values, the semicolon that breaks them, if as a value, loop with break, while, for over ranges and labelled loops.
Tuples group a few values of different types. Arrays hold a fixed number of values of one type, and the length is part of the type. A slice is a view into part of an array, so one function can take any length.
Rust has two string types, String and &str, and both hold UTF-8 bytes. This part shows why len counts bytes, why s[0] doesn’t compile, how slicing can panic, and the string methods you’ll use every day.
Every value in Rust has exactly one owner. Assigning a String to another variable moves it, and the old name stops working. This part shows what a move does in memory, why Rust needs it, and how Copy, clone and drop fit in.
A reference lets you use a value without taking it. Rust allows many shared references or one mutable reference, never both at once. This part shows the rule, the errors it causes, and why a borrow ends at its last use.
Holding a reference into a Vec and then calling push is the borrow error almost everyone hits first. This part shows why: push can move the whole buffer, and the reference would be left pointing at freed memory.
A lifetime is the stretch of code where a reference is safe to use. This part reads the errors that mention lifetimes, shows what ‘a says in a function signature, and covers the elision rules, structs that hold references and ‘static.
A struct groups named values into one type of your own. This part shows how to define and build structs, how they sit in memory, and how to pick between self, &self and &mut self when you write methods.
An enum is a value that is one of several shapes, and match makes you handle every shape. This part covers enums with data, match and its patterns, Option instead of null, if let, let else and while let.
Rust has no exceptions. A function that can fail returns a Result, and the ? operator passes the error up to its caller. This part covers panic, Result, unwrap, ?, and writing your own error type.
Rust’s standard library has a small set of collections that cover most programs. This part shows Vec, HashMap and its entry API, HashSet, BTreeMap and VecDeque, what each one is good at, and how to pick.
A trait is a set of methods that many types can share. This part shows how to define and implement traits, what derive writes for you, how to make {} work with Display, and the orphan rule that decides who may write an impl.
Generics let you write one function or struct that works for many types. This part covers type parameters, trait bounds, where clauses, impl Trait, const generics, and what the compiler really builds from a generic function.
A closure is a small function you write in place, and it can use the variables around it. This part shows how a closure captures them, by reference, by mutable reference or by value, and what Fn, FnMut and FnOnce mean.
An iterator hands out items one at a time through next. This part shows how iter, iter_mut and into_iter differ, why map and filter do nothing until something consumes them, and how collect builds a Vec, a String or a map.
Modules split a Rust program into named parts, and everything in them is private until you write pub. This part covers mod, pub, paths, use, files, library and binary crates, and workspaces.
Rust has a test runner built in. This part writes unit tests, integration tests and doc tests for a small library, reads what a failing test prints, and lets a test catch a real bug.
Box puts a value on the heap, Rc lets several owners share one value, RefCell lets you change a value behind a shared reference, and Weak breaks the cycles that would leak memory. This part shows each one, with the counts printed.
A Vec holds one type, so how do you keep circles and squares in the same list? This part covers dyn Trait, the fat pointer and vtable behind it, static vs dynamic dispatch, and which traits can be used with dyn.
Make + work on your own types, see why Iterator has an associated type and not a parameter, follow a Box through Deref to a str, and learn exactly when Rust runs Drop.
A thread runs code side by side with the rest of your program. This part shows thread::spawn and join, why spawn needs move, how scoped threads borrow safely, and what Send and Sync mean.
Threads that change one value need a lock or an atomic, and threads that hand work to each other need a channel. This part shows Arc with Mutex, RwLock, AtomicUsize and mpsc, and makes a deadlock happen on purpose.
The two meanings of ‘static, what T: ‘a says, why Box of dyn Trait means ‘static, structs that need two lifetimes, and how to read E0716, E0521 and E0505 line by line.
An async fn returns a future that does nothing until something polls it. We build that something by hand with the standard library, a waker and a run queue, and then run the same program on tokio.
Two structs with the same three fields can have different sizes. This part covers size_of, alignment, padding, how Rust lays out enums, and why an Option of a reference costs no extra bytes.
The unsafe keyword unlocks five extra abilities, such as reading through a raw pointer. It doesn’t switch off the borrow checker. This part shows what unsafe allows, what undefined behaviour is, and how to wrap unsafe code in a safe API.
A macro is code that writes code before the compiler checks it. This part shows why println! and vec! are macros, how to write your own with macro_rules!, how repetition and hygiene work, and when a plain function is the better choice.
The last part builds a small key-value server over TCP with only the standard library. It has a line protocol, a shared map, a pool of worker threads, a clean shutdown, and tests that talk to it over real sockets.