Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust Mastery Notes

This is my learn-by-doing knowledge base — the distilled lessons from each Rust concept I drill in rust-scratch.

For every concept I finish a ladder of 7–9 problems (foundations → mechanics → footguns → real-world patterns → a build-it-from-scratch capstone), living in src/bin/<concept>.rs. Once a ladder is done, I write the lasting takeaways here — the mental model, the signatures worth memorizing, the footguns I hit, and the “explain it back” prompts that prove I actually own it.

The code is the gym. This is the notebook.

How to read a note

Each concept page follows the same shape:

SectionWhat’s in it
TL;DRThe one-paragraph mental model.
Why it existsThe problem this concept solves.
The ladderThe 7–9 rungs I worked, what each one taught.
Signatures to knowThe std types/bounds worth memorizing.
FootgunsThe traps I hit (or that the ladder deliberately set).
Explain it backQuestions I should be able to answer cold.

Completed concepts

ConceptNoteSource ladder
Modules & visibility✅ notesrc/bin/modules.rs
Cargo features & cfg✅ notesrc/bin/features_cfg.rs
Testing✅ notesrc/bin/testing.rs + practice/testing_lab/
Cow✅ notesrc/bin/cow.rs
Box & the heap✅ notesrc/bin/box_heap.rs
Rc / Arc✅ notesrc/bin/rc_arc.rs
Cell / RefCell✅ notesrc/bin/cell_refcell.rs
Rc<RefCell<T>> patterns✅ notesrc/bin/rc_refcell.rs
Conversion traits✅ notesrc/bin/conversions.rs
Lifetimes in depth✅ notesrc/bin/lifetimes_depth.rs
HRTB — for<'a>✅ notesrc/bin/hrtb.rs
Borrow / ToOwned✅ notesrc/bin/borrow_toowned.rs
Drop & ordering✅ notesrc/bin/drop_ordering.rs
Associated types vs generic params✅ notesrc/bin/assoc_vs_generic.rs
Generic bounds & where clauses✅ notesrc/bin/generic_bounds.rs
Blanket impls & coherence✅ notesrc/bin/blanket_coherence.rs
Static vs dynamic dispatch✅ notesrc/bin/dispatch.rs
Closures & Fn/FnMut/FnOnce✅ notesrc/bin/closures.rs
impl Trait & RPIT✅ notesrc/bin/impl_trait.rs
Marker & auto traits✅ notesrc/bin/marker_auto_traits.rs
Error handling architecture✅ notesrc/bin/error_arch.rs
Custom error types✅ notesrc/bin/custom_errors.rs
Builder pattern✅ notesrc/bin/builder.rs
The typestate pattern✅ notesrc/bin/typestate.rs
Newtype & zero-cost wrappers✅ notesrc/bin/newtype.rs
API evolution & semver✅ notesrc/bin/semver.rs
Threads & scoped threads✅ notesrc/bin/threads.rs
Send & Sync deeply✅ notesrc/bin/send_sync.rs
Mutex / RwLock✅ notesrc/bin/mutex_rwlock.rs
Channels✅ notesrc/bin/channels.rs
Data parallelism with rayon✅ notesrc/bin/rayon_parallel.rs
Shared state vs message passing✅ notesrc/bin/concurrency_models.rs
Collections deep-dive✅ notesrc/bin/collections.rs
Strings & text✅ notesrc/bin/strings_text.rs
Iterators end-to-end✅ notesrc/bin/iterators.rs

New notes get added under Concepts as each ladder is finished — see Adding a new note.