Skip to content

Rust Practice

Master ownership, borrowing, lifetimes, and zero-cost abstractions.

ConceptDetails
Memory ModelOwnership + borrowing, no GC, compile-time lifetime checks
Type SystemStrong static, algebraic types (enum), traits, generics, no null
Error HandlingResult<T, E>, Option<T>, ? operator, no exceptions
ConcurrencyFearless concurrency, Send/Sync traits, async/await, Tokio
Buildcargo, crates.io, edition system (2021+)
StandardStable Rust, edition 2021
  • Pattern matching exhaustively on enums
  • Iterator chains over explicit loops (map, filter, collect)
  • impl Trait for return-position polymorphism
  • Newtype pattern for type safety (struct Miles(f64))
  • Builder pattern for complex construction
  • From/Into conversions instead of explicit casts
  • derive macros for common trait implementations
Terminal window
practice/bin/ol list build rust # which of these have references yet
practice/bin/ol start build rust 01 # clone it stubbed into .scratchpad/
practice/bin/ol check build rust 01 # run it; exit code is the verdict
practice/bin/ol diff build rust 01 # your attempt against the reference

Exercises 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.

#ExerciseConceptsDifficulty
01Vec<T> from scratchUnsafe, RawVec, Drop, Deref; recommended before course module L10.1⭐⭐⭐
02Doubly-linked listRc<RefCell<T>> or unsafe, borrow checker challenges; course version: ds.07⭐⭐⭐⭐
03Hash map (Robin Hood)Hashing, Entry API, generics with trait bounds; course version: ds.05⭐⭐⭐⭐
04Channel (mpsc clone)Arc<Mutex<T>>, Condvar, Send bounds; course version: lang.09⭐⭐⭐⭐
05Iterator adaptor libraryIterator trait, associated types, lazy evaluation; course version: L1.5⭐⭐⭐
06CLI argument parserLifetimes, &str vs String, builder pattern⭐⭐
07Async TCP echo serverasync/await, tokio, Pin, Future; course version: lang.09, L10.5⭐⭐⭐⭐
08ECS (Entity Component System)Trait objects vs enums, Any, downcast, arena allocation⭐⭐⭐⭐⭐
09Proc macro for derive(Builder)Procedural macros, syn, quote, token streams⭐⭐⭐⭐
10Lock-free stackAtomicPtr, compare_exchange, ABA problem⭐⭐⭐⭐⭐