Code

Rust

Ownership, borrowing, lifetimes, zero-cost abstractions, fearless concurrency, and systems tooling.

Chapter 1: Why Rust Exists (Memory Safety Without GC, Cargo & Compiler Diagnostics)

How Rust eliminates use-after-free, buffer overflows, and data races at compile time without a garbage collector, powered by Cargo and actionable compiler diagnostics.

6 scenes · 3 min

Chapter 2: Ownership, Moves, `Copy` vs `Clone` & Stack/Heap Layout

Mastering Rust's core memory model: stack frames versus heap allocations, move semantics, deterministic `Drop`, bitwise `Copy` vs deep `Clone`, and `std::mem` utilities.

6 scenes · 3 min

Chapter 3: Borrowing, References, Slices & Aliasing XOR Mutability

Mastering `&T` and `&mut T`, Rust's aliasing-XOR-mutability law, Non-Lexical Lifetimes, zero-copy slices (`&[T]` and `&str`), deref coercion, and split borrows.

6 scenes · 3 min

Chapter 4: Structs, Enums, Pattern Matching & Algebraic Data Types

Modeling domain invariants so illegal states cannot be represented: structs, newtypes, tagged-union enums, exhaustive `match`, `let ... else`, and niche optimization.

6 scenes · 3 min

Chapter 5: Error Handling (`Option`, `Result`, `?` Operator & Custom Errors)

Handling failure explicitly without exceptions: `Option<T>`, `Result<T, E>`, functional combinators, `?` propagation with `From`, custom error enums, and panic boundaries.

6 scenes · 3 min

Chapter 6: Traits, Generics, Monomorphization & Dynamic Dispatch (`dyn Trait`)

Polymorphism without inheritance: traits, generic bounds, compile-time monomorphization, vtable-backed `dyn Trait` fat pointers, dyn compatibility, and essential stdlib traits.

6 scenes · 3 min

Chapter 7: Lifetimes & Borrow Checker Mental Models

Demystifying `'a` annotations, lifetime elision rules, borrowed struct fields, `'static` bounds vs references, subtyping variance, and higher-ranked trait bounds (`for<'a>`).

6 scenes · 3 min

Chapter 8: Smart Pointers (`Box`, `Rc`, `Arc`, `RefCell`, `Mutex`) & Interior Mutability

Going beyond single-owner stack rules safely: `Deref`/`Drop`, `Box<T>`, `Rc`/`Weak`, interior mutability via `Cell` and `RefCell`, thread-safe `Arc<Mutex<T>>`, and `Cow`.

6 scenes · 2 min

Chapter 9: Collections, Iterators, Closures & Zero-Cost Abstractions

Mastering `Vec<T>` growth, `HashMap`/`BTreeMap` and the Entry API, lazy iterator pipelines, `Fn`/`FnMut`/`FnOnce` closures, and verifying zero-cost assembly output.

6 scenes · 3 min

Chapter 10: Fearless Concurrency (Threads, Channels, `Send`/`Sync` & Deadlock Prevention)

Multi-threaded systems programming where data races are compile errors: OS threads, scoped threads, bounded channels, `Send`/`Sync` traits, lock ordering, and atomics.

6 scenes · 3 min

Chapter 11: Async Rust & Tokio (Futures, `Pin`, Polling, Structured Concurrency)

How Rust achieves massive I/O concurrency without a mandatory runtime: pull-based `Future::poll`, compiler-generated state machines, `Pin<P>`, `Waker`/Tokio executors, avoiding blocking, and `select!`/`join!`.

6 scenes · 3 min

Chapter 12: Unsafe Rust, Raw Pointers & C FFI Safety Boundaries

Understanding Rust's escape hatch responsibly: the five unsafe superpowers, raw pointer invariants, Undefined Behavior & Miri, C FFI (`extern "C"`, `#[repr(C)]`), safe abstractions, and `MaybeUninit`.

6 scenes · 3 min

Chapter 13: Testing, Benchmarking, Clippy & Profiling

Shipping rock-solid, fast Rust binaries: unit/integration/doc tests, `#[should_panic]` & property testing, Clippy lints, `black_box` & Criterion benchmarks, CPU/heap profiling, and supply-chain hardening.

6 scenes · 3 min

Chapter 14: Building a Fast Single-Binary CLI & Network Utility in Rust

Putting all 13 chapters together into real production tools: thin `main.rs` + testable `lib.rs`, buffered streaming I/O, pure-std TCP networking with timeouts, clean exit codes, static releases, and an end-to-end capstone.

6 scenes · 3 min