Rust Practice
Master ownership, borrowing, lifetimes, and zero-cost abstractions.
Language Essentials
Section titled “Language Essentials”| Concept | Details |
|---|---|
| Memory Model | Ownership + borrowing, no GC, compile-time lifetime checks |
| Type System | Strong static, algebraic types (enum), traits, generics, no null |
| Error Handling | Result<T, E>, Option<T>, ? operator, no exceptions |
| Concurrency | Fearless concurrency, Send/Sync traits, async/await, Tokio |
| Build | cargo, crates.io, edition system (2021+) |
| Standard | Stable Rust, edition 2021 |
Key Idioms
Section titled “Key Idioms”- Pattern matching exhaustively on enums
- Iterator chains over explicit loops (
map,filter,collect) impl Traitfor return-position polymorphism- Newtype pattern for type safety (
struct Miles(f64)) - Builder pattern for complex construction
From/Intoconversions instead of explicit castsderivemacros for common trait implementations
Reference Documentation
Section titled “Reference Documentation”- The Rust Programming Language — free, the official book
- Rust by Example — free, learn by doing
- std library docs — API reference
- Rustonomicon — unsafe Rust deep dive
- Programming Rust (Blandy, Orendorff, Tindall) — comprehensive reference
Practising these
Section titled “Practising these”practice/bin/ol list build rust # which of these have references yetpractice/bin/ol start build rust 01 # clone it stubbed into .scratchpad/practice/bin/ol check build rust 01 # run it; exit code is the verdictpractice/bin/ol diff build rust 01 # your attempt against the referenceExercises are ordered by concept, not by difficulty, so pick by the stars rather than by the number. An exercise listed below with no reference yet is a row in this table and nothing more; see the practice path for how the harness works.
Exercises
Section titled “Exercises”| # | Exercise | Concepts | Difficulty |
|---|---|---|---|
| 01 | Vec<T> from scratch | Unsafe, RawVec, Drop, Deref; recommended before course module L10.1 | ⭐⭐⭐ |
| 02 | Doubly-linked list | Rc<RefCell<T>> or unsafe, borrow checker challenges; course version: ds.07 | ⭐⭐⭐⭐ |
| 03 | Hash map (Robin Hood) | Hashing, Entry API, generics with trait bounds; course version: ds.05 | ⭐⭐⭐⭐ |
| 04 | Channel (mpsc clone) | Arc<Mutex<T>>, Condvar, Send bounds; course version: lang.09 | ⭐⭐⭐⭐ |
| 05 | Iterator adaptor library | Iterator trait, associated types, lazy evaluation; course version: L1.5 | ⭐⭐⭐ |
| 06 | CLI argument parser | Lifetimes, &str vs String, builder pattern | ⭐⭐ |
| 07 | Async TCP echo server | async/await, tokio, Pin, Future; course version: lang.09, L10.5 | ⭐⭐⭐⭐ |
| 08 | ECS (Entity Component System) | Trait objects vs enums, Any, downcast, arena allocation | ⭐⭐⭐⭐⭐ |
| 09 | Proc macro for derive(Builder) | Procedural macros, syn, quote, token streams | ⭐⭐⭐⭐ |
| 10 | Lock-free stack | AtomicPtr, compare_exchange, ABA problem | ⭐⭐⭐⭐⭐ |