Rust
Lifetimes
Understanding what 'a actually
means — with the memory-management story that makes it make sense.
A refined flat-vector book cover illustration: on a warm cream paper background, a large brass hourglass sits on a craftsman's wooden workbench beside woodworking tools; the sand falling inside the hourglass streams into the shape of a bold apostrophe-and-letter mark ('a) in oxide-rust orange. Deep teal and burnt-orange accent palette, generous negative space, subtle paper-grain texture, no text or lettering other than the 'a formed by the sand. Target size ~1200×800px, 3:2 landscape; compose with the hourglass centred and safe margins — the art is letterboxed into a 3:2 box, so keep nothing important near the edges.
Generate this with your image agent, then drop the file here.
Contents
- The Trouble with Lifetimes why it's hard, and the workshop model
- Stack, Heap, and the Shape of Memory where data lives; who cleans up
- Ownership, Moves, and Drop one owner; the brace is the destructor
- Borrowing: References Without Ownership shared XOR mutable; loans end before owners
- What a Lifetime Actually Is regions, 'a notation, describe-don't-extend
- Lifetimes in Function Signatures the longest() example, solved properly
- Elision: The Rules You've Been Using three mechanical rules; de-elide to debug
- Lifetimes in Structs and Methods types that borrow are borrows
- 'static: The Most Misunderstood Lifetime forever-references vs. self-contained values
- The Borrow Checker's Mind: NLL and Beyond liveness, Polonius, HRTBs, 2024 capture rules
- Cheatsheet the 30-second version, printable
Chapters 2–4 are the memory-management foundation; 5–8 are the craft of lifetimes themselves; 9–10 are mastery. Use → and ← to turn pages, ↑ to return here. Each chapter ends with challenges — the Rust Playground is your workbench.