Skip to content

Revision · How This Playbook Works

Orientation set up the whole book: a project-first method where you build real programs and the Rust shows up exactly where the build demands it, and the single ownership idea that every later refusal from the compiler traces back to. Here’s what to carry forward.

  • Build first, learn on demand — most material teaches the language and hopes you can build; this playbook inverts that, so you meet each feature the moment a project reaches for it, not as a list to memorize.
  • The shape of Phase 1 — four runnable crates over 15 days: logwise (CLI), kvlite (KV store), apilite (async API), askr (AI CLI), each a standalone crate in rust/ that compiles and runs.
  • The one ownership rule — every value has exactly one owner, the variable responsible for freeing it; when the owner goes out of scope the value is freed automatically, with no GC and no manual free.
  • Move, don’t copy — assigning or passing a heap value moves ownership and invalidates the old binding, which makes a double-free unwritable; .clone() is the explicit, visible opt-in to a real copy.
  • Copy vs move — small stack-only types (i32, bool, char) implement Copy so duplicating their bytes is safe; heap-owning types (String, Vec, Box) move instead, because a byte-copy would create two owners of one buffer.
  • Shared XOR mutable — either one &mut borrow or any number of & borrows, never both at once; that single rule buys no dangling pointers and no data races at compile time (fearless concurrency).
  • The compiler is teaching, not gradingrustc’s errors name the value, the borrow, and often the fix, so the fastest way to learn is to write what you think is right and read the objection.

The throughline is one question held on every page: what does building this force you to understand, and what is Rust’s compiler protecting you from? Almost every refusal is deleting a real bug (a use-after-free, a data race, a forgotten error) before it can exist. With the “one owner” and “shared XOR mutable” rules in hand, you’re ready for Project 1, where reading a file forces the ownership question for the first time.