🦀Rust Lifetimes Explained
Stop reading `'a` as line noise and start reading it as scope arithmetic — one failing snippet at a time — until you can thread lifetimes through a small parser or iterator adapter without fighting the borrow checker.
Phase 1Scopes, References, and Why the Compiler Asks
See `'a` as scope duration, not decoration.
A lifetime is a scope the compiler can point at
6 minA lifetime is a scope the compiler can point at
References are just addresses with an expiration date
6 minReferences are just addresses with an expiration date
Lifetime annotations exist when inference can't guess
6 minLifetime annotations exist when inference can't guess
The borrow checker is a conservative deadline solver
7 minThe borrow checker is a conservative deadline solver
Phase 2Reading and Writing Lifetime Annotations
Fix real compiler errors by annotating functions.
Fix compiler errors with the smallest annotation that works
7 minFix compiler errors with the smallest annotation that works
Three elision rules cover the common cases silently
7 minThree elision rules cover the common cases silently
`'static` means the reference lives forever — literally
7 min`'static` means the reference lives forever — literally
Mutable references are exclusive access for a duration
7 minMutable references are exclusive access for a duration
Longer lifetimes flow into shorter ones — not the other way
8 minLonger lifetimes flow into shorter ones — not the other way
Phase 3Lifetimes Across Structs, Traits, and Bounds
Wire lifetimes through structs, traits, and bounds.
A struct that holds a reference must name the lifetime
8 minA struct that holds a reference must name the lifetime
Every impl on a lifetime-parameterized struct declares the lifetime twice
8 minEvery impl on a lifetime-parameterized struct declares the lifetime twice
The `T: 'a` bound says T has no references shorter than `'a`
8 minGeneric bounds like `T: 'a` mean T doesn't contain any reference shorter than `'a`
Trait bounds and lifetime bounds compose orthogonally
8 minTrait bounds and lifetime bounds compose orthogonally
Phase 4Build a Zero-Copy Parser
Build a zero-copy parser that threads `'a` through.
Thread `'input` through a tiny zero-copy parser
22 minBuild a struct that parses a string without cloning a byte
Frequently asked questions
- What does the `'a` in Rust actually mean?
- This is covered in the “Rust Lifetimes Explained” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- Why does the Rust compiler need lifetime annotations?
- This is covered in the “Rust Lifetimes Explained” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- When do I need to add lifetimes to a struct?
- This is covered in the “Rust Lifetimes Explained” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- What is the lifetime elision rule in Rust?
- This is covered in the “Rust Lifetimes Explained” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
- How are lifetimes different from ownership and borrowing?
- This is covered in the “Rust Lifetimes Explained” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Related paths
🐍Python Decorators Introduction
Build one mental model for Python decorators that covers closures, argument passing, functools.wraps, and stacking — then ship a working caching or logging decorator from scratch in under 30 lines.
☸️Kubernetes Core Concepts
Stop drowning in 30+ resource types. Build the mental model one primitive at a time -- pods, deployments, services, ingress, config -- then deploy a real app with rolling updates and health checks.
💻Elixir Pattern Matching
Stop reading `=` as assignment and start using it as Elixir's core flow-control tool — through function heads, guards, and `with` — until you can rewrite a tiny command parser without a single `if`.
📈Big O Intuition
Stop treating Big O as math you memorized for an interview — build the intuition to spot O(n²) disasters, pick the right data structure without thinking, and rewrite a slow function from O(n²) to O(n) in under five minutes.