Learning Rust · the corpus

Contents

Theory first, then one serious project. Nine parts, roughly 65 to 80 chapters, targeting the Rust 2021 edition.

0OrientationWhy this book exists, and the tools and mindset to begin.
000A Preface, by Way of ConfessionWho is writing this, and how a Go loyalist finally crossed the river.live001The Toolchain and the MindsetInstall it, build hello world, and read the compiler as a tutor.live
IThe Rust IdiomHow idiomatic Rust feels, before the rigor. Motivation, not mechanics.
I01The Shape of Rust CodeRead one small, complete, idiomatic program, naming each idiom.liveI02Values, Not ExceptionsErrors as values: no try/catch, no null, a first look at ?.liveI03The Type-Driven MindsetMake illegal states unrepresentable; the compiler as pair-programmer.live
IIWhat Distinguishes RustThe ideas Rust does not share with the languages you already know.
II01Ownership, ConceptuallyOne owner, move semantics, told as a story with pictures.liveII02Borrowing, ConceptuallyShared versus exclusive references as the answer to 'just looking'.liveII03Traits, Not InheritanceWhy Rust has no class hierarchy and no runtime tax.live
IIIThe Language ReferenceGrammar and semantics, in dependency order. Focused instruction.
III01The Syntax CoreBindings, mutability, scalars, blocks as expressions, control flow.liveIII02Ownership, FormallyMoves, drops, Copy, and the rules the borrow checker enforces.liveIII03Borrowing and ReferencesShared and exclusive references, aliasing XOR mutability, reborrows.liveIII04Slices, a Borrowed ViewString slices and array slices: a borrowed window into a sequence.liveIII05Naming LifetimesElision, explicit 'a, lifetimes in functions and in structs.liveIII06Structs, Your Own TypesFields, impl blocks, methods, associated functions, derive.liveIII07Enums and the Algebraic SumVariants that carry data, the sum-type view, Option as an enum.liveIII08Pattern MatchingExhaustiveness, destructuring, guards, if let, let else, while let.liveIII09Generics, Written OnceGeneric functions and types, monomorphization, where clauses, const generics.liveIII10Traits, Behavior as a ContractDefining and implementing traits, default methods, bounds, coherence.liveIII11Trait Objects and Dynamic Dispatchdyn Trait, object safety, vtables, static versus dynamic dispatch.liveIII12Deref, From, and the Operator TraitsDeref coercion, Index, From/Into, the comparison and Default traits.liveIII13Error Handling, FormallyResult in depth, the ? desugaring, From conversions, custom error types.liveIII14Closures, Functions that RememberFn, FnMut, FnOnce, capture modes, the move keyword.liveIII15Iterators, the Lazy PullThe Iterator trait, next(), laziness, adapters versus consumers, IntoIterator.liveIII16Modules and Visibilitymod, paths, use, pub and pub(crate), the module tree.liveIII17Macros, Code that Writes Codemacro_rules!, fragment specifiers, repetition, hygiene, a glance at derive.liveIII18Unsafe, and the ContractThe five powers of unsafe, raw pointers, and the soundness contract.live
IVThe Complete Standard LibraryA module-by-module reader of std, total coverage guaranteed.
IV07MonadsThe chainable box: Option, Result, iterators, futures, and your own.live
VThe EcosystemCargo and the load-bearing crates: the bridge from std to dependencies.
V01Cargo, Crates and SemverDependencies, versioning, workspaces, features.planned
VIArchitectureDesigning the project, taught as applied Rust.
VI01The Problem and The ShapeWhat the observability stack does, and its components.planned
VIIImplementation: Single NodeBuild the observability stack, one runnable phase at a time.
VII01The SkeletonThe workspace, the core types crate, the test harness.planned
VIIIDistributed CapstoneReplication, gossip, and sharded queries: fearless concurrency, cashed.
VIII01ReplicationLeader/follower shipping from the write-ahead log.planned