Search

260522_1144_rust curriculum

Rust Programming Language — 52-Week Deep Study Curriculum

Goal: Take a complete beginner from zero to advanced Rust mastery over 52 weeks, covering ownership, borrowing, lifetimes, concurrency primitives (Mutex, Semaphore, Monitor), traits (Rust's answer to inheritance), algorithms, and systems-level programming.
Format: Each week has a theme, key concepts, hands-on exercises, and a mini-project. Estimated study time: 8–12 hours/week.

Phase 1 — Foundations (Weeks 1–10)

Week 1 — Environment Setup & Hello, Rust

Concepts
Install Rust via rustup, understand toolchain management
rustc, cargo, rustfmt, clippy — what each tool does
Cargo project structure: Cargo.toml, src/main.rs, src/lib.rs
Compile and run your first program
Understanding the compilation model (LLVM backend)
Exercises
1.
Install Rust and print the version: rustc --version, cargo --version
2.
cargo new hello_rust → modify main.rs to print your name and today's date
3.
Run cargo fmt and cargo clippy on your project
4.
Add a dependency (chrono) in Cargo.toml and use it to print the current time
Mini-Project Build a CLI that prints a greeting message with the current timestamp.

Week 2 — Variables, Data Types & Control Flow

Concepts
let, let mut, constants (const, static)
Scalar types: integers (i8i128, u8u128, isize, usize), floats (f32, f64), bool, char
Compound types: tuples, arrays (fixed-size), slices
Type inference vs. explicit annotation
Shadowing vs. mutation
if/else, loop, while, forin
match basics (exhaustive pattern matching)
Exercises
1.
Write a Fibonacci sequence generator using a for loop
2.
Use shadowing to convert a string to an integer and back
3.
Write a match expression that handles all integer ranges 0–100 with descriptive output
4.
Implement a simple temperature converter (Celsius Fahrenheit) using functions
Mini-Project Build a number-guessing game (generate random number, loop until user guesses correctly).

Week 3 — Functions, Closures & Iterators (Introduction)

Concepts
Function syntax, parameters, return types
Expressions vs. statements (Rust returns the last expression)
Closures: capture by reference, capture by value (move)
Fn, FnMut, FnOnce traits (overview)
Iterator basics: iter(), into_iter(), iter_mut()
Common iterator adapters: map, filter, fold, collect, enumerate, zip
Exercises
1.
Write a higher-order function that accepts a closure and applies it to a vector
2.
Implement factorial both iteratively and recursively
3.
Use map + filter + collect to process a list of numbers
4.
Rewrite a for loop using fold
Mini-Project Build a word frequency counter that reads a hard-coded string and outputs the top-5 most frequent words.

Week 4 — Ownership: The Core of Rust

Concepts
The three ownership rules
Move semantics: what happens when you assign or pass a value
Stack vs. heap (why ownership matters for heap data)
Clone and Copy traits
Drop and RAII (Resource Acquisition Is Initialization)
Why Rust has no garbage collector
Exercises
1.
Demonstrate move by writing code that causes a compile error, then fix it with .clone()
2.
Show that i32 implements Copy and String does not
3.
Implement a custom struct, derive Clone, and trace when drop is called using println!
4.
Write a function that takes ownership and returns it back
Mini-Project Implement a simple resource manager (e.g., a "File Handle" wrapper) that prints a message when it is dropped.

Week 5 — Borrowing & References

Concepts
Shared references (&T) — many readers
Mutable references (&mut T) — one writer, no readers
The borrow checker's rules
Dangling references and why Rust prevents them
Slices as borrowed views (&str, &[T])
Reference vs. pointer mental model
Exercises
1.
Write a function that takes &String and returns the first word as &str
2.
Show a compile error caused by simultaneous & and &mut, then fix it
3.
Use slices to implement a function that returns the largest element in a &[i32]
4.
Write a function that modifies a vector through &mut Vec<i32>
Mini-Project Build a simple in-memory text analyzer (count words, sentences, characters) using borrowed string slices.

Week 6 — Lifetimes

Concepts
Why lifetimes exist (preventing dangling references)
Lifetime annotation syntax: 'a, 'b, 'static
Lifetime elision rules (when you don't need to write them)
Lifetimes in structs and methods
The 'static lifetime
Common lifetime errors and how to fix them
Exercises
1.
Write a longest function that returns the longer of two string slices with explicit lifetime annotations
2.
Create a struct that holds a reference and annotate its lifetime
3.
Implement a struct method that returns a reference to one of its fields
4.
Demonstrate 'static with a string literal vs. a heap-allocated string
Mini-Project Implement a TextBuffer struct that caches a borrowed slice and exposes search methods — all without cloning the original string.

Week 7 — Structs, Methods & Associated Functions

Concepts
Defining structs (regular, tuple, unit)
impl blocks: methods (&self, &mut self, self) and associated functions
Derived traits: Debug, Clone, PartialEq, Eq, Hash
Builder pattern basics
Struct update syntax
Exercises
1.
Implement a Rectangle struct with area, perimeter, and is_square methods
2.
Add a new associated function (constructor pattern)
3.
Derive Debug and print with {:?} and {:#?}
4.
Use struct update syntax to create a modified copy
Mini-Project Implement a BankAccount struct with deposit, withdraw, and balance methods, enforcing invariants.

Week 8 — Enums & Pattern Matching

Concepts
Enums with and without data
Option<T> — Rust's null safety
Result<T, E> — Rust's error handling
Exhaustive match with guards
if let, while let, let else
Nested pattern matching, destructuring
Exercises
1.
Define a Shape enum (Circle, Rectangle, Triangle) and implement an area method
2.
Write a function returning Option<T> and handle it with match and ? operator
3.
Chain Result operations using ?
4.
Use if let to simplify a match with a single arm
Mini-Project Build a small expression evaluator: parse a string like "3 + 4 * 2" and return the result using enums for tokens/AST nodes.

Week 9 — Error Handling

Concepts
panic! vs. recoverable errors
unwrap, expect, ? operator
From and Into traits for error conversion
Custom error types
The thiserror and anyhow crates
When to use panic! vs. Result
Exercises
1.
Write a file-reading function that propagates errors with ?
2.
Implement a custom error enum with std::fmt::Display and std::error::Error
3.
Use thiserror to define domain-specific errors
4.
Use anyhow for application-level error aggregation
Mini-Project Build a CSV parser that returns structured Result errors for malformed input (wrong column count, parse failures).

Week 10 — Collections & Standard Library Deep Dive

Concepts
Vec<T>: growth strategy, capacity, push, pop, drain, retain
HashMap<K, V>: hashing, collision, entry API (or_insert, or_insert_with)
HashSet<T>, BTreeMap<K, V>, BTreeSet<T>
VecDeque<T>, LinkedList<T> (and why to rarely use linked lists)
String vs. &str — when to use each
Iterating collections efficiently
Exercises
1.
Implement a group-by operation using HashMap
2.
Find duplicates in a vector using HashSet
3.
Use the entry API to build a word-frequency map
4.
Implement a simple LRU cache using VecDeque + HashMap
Mini-Project Build a simple in-memory key-value store with CRUD operations, backed by HashMap.

Phase 2 — Intermediate (Weeks 11–25)

Week 11 — Traits: Rust's Polymorphism System

Concepts
Defining and implementing traits
Default method implementations
Trait bounds: fn foo<T: Trait>(...) and where clauses
Multiple trait bounds: T: Trait1 + Trait2
Supertraits
Traits vs. inheritance (why Rust chose composition)
Exercises
1.
Define a Shape trait with area and perimeter, implement for Circle and Rectangle
2.
Write a generic function bounded by multiple traits
3.
Implement a Printable trait with a default method
4.
Create a supertrait relationship (Animal: Display)
Mini-Project Design a plugin system: define a Plugin trait, implement three plugins, and run them through a Vec<Box<dyn Plugin>>.

Week 12 — Trait Objects & Dynamic Dispatch

Concepts
dyn Trait — runtime polymorphism
Box<dyn Trait>, &dyn Trait, Arc<dyn Trait>
Object safety rules
Static dispatch (monomorphization) vs. dynamic dispatch (vtable)
Performance trade-offs
Fat pointers
Exercises
1.
Build a heterogeneous collection of trait objects
2.
Demonstrate object safety violations and fix them
3.
Benchmark static vs. dynamic dispatch for a compute-heavy loop
4.
Implement a simple event system using Box<dyn Fn()> callbacks
Mini-Project Implement a UI component tree where each node implements a Render trait — rendered via dynamic dispatch.

Week 13 — Generics & Monomorphization

Concepts
Generic structs, enums, functions
Phantom types (PhantomData<T>)
Type parameters vs. associated types
Generic bounds in impl blocks
Turbofish syntax (::<>)
Code bloat from monomorphization and mitigation
Exercises
1.
Implement a generic Stack<T> with push, pop, peek
2.
Use PhantomData to encode type-level state (e.g., a typed ID)
3.
Write a generic min function with appropriate trait bounds
4.
Compare associated types vs. type parameters in a trait design
Mini-Project Implement a type-safe unit system (meters, kilograms, seconds) using PhantomData so that adding Meters + Kilograms is a compile error.

Week 14 — Closures & Iterators (Advanced)

Concepts
Fn vs. FnMut vs. FnOnce — when each applies
move closures and thread safety
Implementing Iterator manually
Lazy evaluation and infinite iterators
chain, flat_map, scan, take_while, peekable
impl Trait in return position
Exercises
1.
Implement a custom iterator over a tree structure
2.
Create a lazy Fibonacci iterator
3.
Write a compose function that chains two Fn closures
4.
Return impl Iterator from a function (avoiding Box<dyn Iterator>)
Mini-Project Build a data pipeline with chained iterator adapters: read numbers, filter negatives, square, deduplicate, and sum.

Week 15 — Smart Pointers

Concepts
Box<T> — heap allocation and recursive types
Rc<T> — reference counting (single-threaded)
RefCell<T> — interior mutability at runtime
Rc<RefCell<T>> pattern
Weak<T> — breaking reference cycles
Cell<T> for Copy types
Exercises
1.
Use Box<T> to implement a recursive linked list
2.
Implement a graph with shared nodes using Rc<RefCell<Node>>
3.
Demonstrate a reference cycle and break it with Weak<T>
4.
Use Cell<i32> for a counter inside a shared struct
Mini-Project Implement a doubly-linked list using Rc<RefCell<Node>> with push_front, push_back, pop_front, and traversal.

Week 16 — Concurrency Fundamentals

Concepts
Rust's concurrency model: fearless concurrency
std::thread::spawn, JoinHandle
Thread safety: Send and Sync marker traits
move closures in threads
Scoped threads (std::thread::scope)
Thread panics and handling them
Exercises
1.
Spawn 10 threads, each printing their ID, and join all of them
2.
Use move to transfer ownership into a thread
3.
Use scoped threads to borrow stack data safely
4.
Demonstrate a compile error when trying to share a non-Send type
Mini-Project Implement a parallel word count: split a large text into N chunks, count words in parallel using threads, and merge results.

Week 17 — Mutex & Shared State

Concepts
Mutex<T> — mutual exclusion for shared data
Arc<T> — atomic reference counting for multi-thread sharing
Arc<Mutex<T>> — the canonical shared mutable state pattern
Lock poisoning and handling it
Deadlock conditions and prevention
RwLock<T> — multiple readers or one writer
Exercises
1.
Share a counter across 10 threads using Arc<Mutex<i32>>
2.
Demonstrate lock poisoning recovery
3.
Implement a thread-safe cache using Arc<RwLock<HashMap<K,V>>>
4.
Deliberately create a deadlock (in a safe context) and explain how to fix it
Mini-Project Implement a thread pool that uses a shared job queue (Arc<Mutex<VecDeque<Job>>>), where N worker threads pull and execute jobs.

Week 18 — Semaphore & Condvar

Concepts
Condvar (condition variable) — waiting for a condition
Mutex + Condvar for producer/consumer problems
Semaphore pattern in Rust (implementing one from scratch)
Arc<(Mutex<T>, Condvar)> idiom
Spurious wakeups and wait_while
Barrier: std::sync::Barrier
Exercises
1.
Implement a bounded semaphore using Mutex<usize> + Condvar
2.
Build a producer/consumer queue with Condvar to block when empty/full
3.
Use Barrier to synchronize N threads to start simultaneously
4.
Implement a one-shot notification channel with Condvar
Mini-Project Implement a classic dining philosophers problem using Mutex (one per fork) and avoid deadlock via resource ordering.

Week 19 — Channels & Message Passing

Concepts
std::sync::mpsc — multi-producer single-consumer channel
Sender<T>, Receiver<T>, SyncSender<T>
Bounded vs. unbounded channels
Channel as synchronization primitive
crossbeam-channel — the ergonomic alternative
Select over multiple channels
Exercises
1.
Build a pipeline with three stages connected by channels
2.
Use multiple senders from different threads
3.
Implement a timeout using recv_timeout
4.
Use crossbeam-channel::select! to merge two incoming streams
Mini-Project Build a work-stealing task distributor: one dispatcher sends tasks to N worker channels, workers send results back to a result channel.

Week 20 — Atomic Operations

Concepts
std::sync::atomic types: AtomicBool, AtomicUsize, AtomicI32, etc.
Ordering: Relaxed, Acquire, Release, AcqRel, SeqCst
Compare-and-swap (compare_exchange)
Lock-free programming fundamentals
When to use atomics vs. Mutex
Memory fences
Exercises
1.
Implement a thread-safe counter using AtomicUsize
2.
Implement a spinlock using AtomicBool + CAS
3.
Build a lock-free stack using AtomicPtr (unsafe, but educational)
4.
Measure performance: AtomicUsize vs. Mutex<usize> under contention
Mini-Project Implement a lock-free reference counter from scratch using AtomicUsize (a simplified Arc).

Week 21 — Async/Await Foundations

Concepts
Why async? I/O-bound vs. CPU-bound concurrency
async fn and the Future trait
.await syntax and how it desugars
async blocks
Tokio runtime setup
tokio::task::spawn, tokio::time::sleep
async fn in traits — stable since Rust 1.75 (no more async-trait crate needed for basic use)
Return-position impl Trait in traits (RPITIT) — stable since Rust 1.75
Exercises
1.
Write your first async fn that fetches a URL using reqwest
2.
Run two async tasks concurrently with tokio::join!
3.
Use tokio::select! to race two futures
4.
Spawn background tasks and await their JoinHandle
Mini-Project Build an async HTTP client that fetches 10 URLs concurrently and measures total elapsed time vs. sequential fetching.

Week 22 — Async Deep Dive: Futures & Executors

Concepts
The Future trait: poll, Waker, Context
Implementing Future manually
Pin and Unpin — why async requires pinning
Box::pin, pin! macro
Streams (futures::Stream) — async iterators
Executor internals (conceptual)
Exercises
1.
Implement a simple TimerFuture from scratch
2.
Use futures::stream::iter and process with StreamExt
3.
Pin a Future manually and explain why it's necessary
4.
Write an async generator using async_stream crate
5.
Define a trait with async fn directly (no async-trait crate) and implement it
Mini-Project Implement a simple single-threaded async executor that can drive simple Futures to completion.

Week 23 — Modules, Crates & Workspaces

Concepts
Module system: mod, use, pub, pub(crate), pub(super)
File-based modules vs. inline modules
Re-exporting with pub use
Cargo workspace: multiple crates sharing a Cargo.lock
Feature flags in Cargo.toml
Conditional compilation: #[cfg(...)]
Exercises
1.
Refactor a monolithic file into a module tree
2.
Create a Cargo workspace with a library crate and a binary crate
3.
Add a feature flag that enables optional functionality
4.
Use #[cfg(test)] to gate test-only helpers
Mini-Project Restructure the CSV parser from Week 9 into a workspace: csv_core (library) + csv_cli (binary).

Week 24 — Testing, Benchmarking & Documentation

Concepts
Unit tests with #[test] inside #[cfg(test)] modules
Integration tests in tests/
Doc tests in /// comments
assert!, assert_eq!, assert_ne!, panic in tests
Benchmarking with criterion
cargo test, cargo bench
Writing documentation: rustdoc, cargo doc
Exercises
1.
Write unit, integration, and doc tests for the BankAccount from Week 7
2.
Add a criterion benchmark comparing two sorting implementations
3.
Document a public API with examples that double as doctests
4.
Use #[should_panic(expected = "...")] to test panics
Mini-Project Achieve 100% test coverage (by inspection) for the key-value store from Week 10, including edge cases.

Week 25 — Unsafe Rust (Introduction)

Concepts
What unsafe allows: raw pointers, calling unsafe fns, implementing unsafe traits
const T and mut T — raw pointers
Dereferencing raw pointers
unsafe impl Send / Sync
When unsafe is justified vs. when to avoid it
Undefined behavior in Rust
Exercises
1.
Use raw pointers to swap two values without using std::mem::swap
2.
Implement a simple memory allocator interface using raw pointers
3.
Call a C function via FFI (use libc crate)
4.
Write a safe wrapper around an unsafe interface
Mini-Project Implement a safe Vec-like structure (simplified) backed by raw pointer + std::alloc::alloc/dealloc.

Phase 3 — Advanced (Weeks 26–40)

Week 26 — Advanced Lifetimes

Concepts
Higher-ranked trait bounds (HRTBs): for<'a> Fn(&'a T)
Lifetime subtyping and variance (covariance, contravariance, invariance)
'static bounds on trait objects
Lifetime in closures
Lending iterators and the streaming iterator problem
Self-referential structs (and why they need Pin)
Exercises
1.
Write a function taking impl for<'a> Fn(&'a str) -> &'a str
2.
Demonstrate variance with a function pointer and a mutable reference
3.
Implement a struct that yields references to its own data (streaming iterator)
4.
Use ouroboros or self_cell crate for self-referential structs
Mini-Project Design a LendingIterator trait and implement it for a chunked buffer that yields overlapping windows.

Week 27 — Advanced Traits

Concepts
Operator overloading via std::ops traits
Deref and DerefMut — smart pointer ergonomics
From, Into, TryFrom, TryInto
Display, Debug, FromStr
Iterator adapters: implementing custom adapters
Specialization (nightly) — overview only
Exercises
1.
Overload +, , for a Vector2D type
2.
Implement Deref<Target = str> for a custom MyString type
3.
Implement TryFrom<&str> for a domain type with validation
4.
Write a custom iterator adapter (e.g., GroupBy<I>)
Mini-Project Implement a full Matrix<T> type with Add, Mul, Index, Display, and From<Vec<Vec<T>>>.

Week 28 — Macros (Declarative)

Concepts
macro_rules! syntax
Macro hygiene
Fragment specifiers: expr, stmt, ident, ty, pat, block, tt, literal
Repetitions: $(...)*, $(...)+, $(...)?
Recursive macros
#[macro_export] and macro scoping
Exercises
1.
Implement a vec!like macro that accepts any number of arguments
2.
Write a map! macro for constructing HashMaps inline
3.
Implement an assert_approx_eq! macro for floating-point comparisons
4.
Write a recursive macro that generates a nested data structure
Mini-Project Implement a simple DSL macro for defining state machines: state_machine! { states: [A, B, C], transitions: [A -> B on foo, B -> C on bar] }.

Week 29 — Macros (Procedural)

Concepts
Three types: #[derive], attribute macros, function-like macros
The proc-macro crate and TokenStream
syn crate for parsing Rust syntax
quote! macro for generating code
Custom #[derive] traits
Common pitfalls and debugging proc macros
Exercises
1.
Implement a #[derive(Builder)] macro for a struct
2.
Write an attribute macro #[retry(n=3)] that wraps a function with retry logic
3.
Create a function-like macro sql!(SELECT * FROM users) that validates at compile time
4.
Debug a proc macro using eprintln! and cargo expand
Mini-Project Implement a full #[derive(Serialize, Deserialize)] for a simple subset of JSON (integers, strings, structs).

Week 30 — Type System Deep Dive

Concepts
Newtype pattern
Zero-cost abstractions
Phantom types for state machines at compile time
Const generics (const N: usize) — basic const generics stable since 1.51; complex const expressions (e.g. [T; N + M]) are still limited on stable 1.95
const fn — significantly expanded in 1.95; many std operations now constevaluable
Type aliases (type) vs. newtypes
Sized and ?Sized
Exercises
1.
Use the newtype pattern to create a Meters(f64) that cannot be confused with Seconds(f64)
2.
Implement a type-state machine: Door<Locked> vs. Door<Unlocked> — method availability differs
3.
Use const generics to implement Matrix<T, const R: usize, const C: usize>
4.
Write a function that works on both Sized and unsized types with ?Sized
Mini-Project Build a type-safe HTTP request builder using phantom type states: Request<NoUrl>, Request<HasUrl>, Request<Sent>.

Week 31 — FFI (Foreign Function Interface)

Concepts
Calling C from Rust: extern "C" blocks
Calling Rust from C: #[no_mangle], extern "C" fn
C data types in Rust: c_int, c_char, c_void
Rust strings vs. C strings: CString, CStr
Memory ownership across FFI boundaries
bindgen for auto-generating bindings
Exercises
1.
Call strlen from libc via FFI
2.
Write a Rust function callable from C (compile to cdylib)
3.
Use CString to safely pass strings to a C function
4.
Generate bindings for a small C library using bindgen
Mini-Project Wrap the C zlib compression library with a safe Rust API using FFI.

Week 32 — Systems Programming: Memory & Allocation

Concepts
Custom allocators: GlobalAlloc (stable); Allocator trait is nightly-only as of 1.95
std::alloc::{alloc, dealloc, realloc, Layout}
Stack vs. heap allocation patterns
Arena allocators and bump allocators
Memory layout of structs: alignment, padding, repr(C), repr(packed)
MaybeUninit<T> for uninitialized memory
Exercises
1.
Implement a bump allocator using GlobalAlloc
2.
Use MaybeUninit to construct a large array without initializing all elements
3.
Print struct sizes and alignment using std::mem::size_of and align_of
4.
Use repr(C) and verify layout compatibility with a C struct
Mini-Project Implement an arena allocator that hands out references with an arena lifetime, freeing all at once when the arena drops.

Week 33 — Async Advanced: Tokio Internals & Patterns

Concepts
Tokio task scheduler internals (work-stealing)
tokio::sync: Mutex, RwLock, Semaphore, Notify, watch, broadcast, oneshot
Structured concurrency with task sets
Cancellation and CancellationToken (from tokio-util crate, not tokio itself)
select! patterns and cancellation safety
tokio::io traits: AsyncRead, AsyncWrite
Exercises
1.
Use tokio::sync::Semaphore to limit concurrency to N simultaneous tasks
2.
Build a broadcast system where one sender fans out to many receivers
3.
Implement graceful shutdown using CancellationToken (add tokio-util to Cargo.toml)
4.
Implement an async TCP echo server using tokio::net::TcpListener
Mini-Project Build an async connection pool: N connections managed by a Semaphore, handed out as guards that release the permit on drop.

Week 34 — Error Handling Mastery

Concepts
Error taxonomy: expected errors, bugs, panics
Structured error types with context (error chaining)
thiserror for library errors, anyhow for application errors
Backtraces in errors
Error reporting with miette (pretty diagnostics)
Designing error types for public APIs
Exercises
1.
Implement a multi-level error hierarchy using thiserror with #[from]
2.
Add backtrace support to a custom error type
3.
Use miette to render a pretty diagnostic with source code annotation
4.
Design an error type for a public library and write docs for each variant
Mini-Project Redesign the CSV parser's error system: structured errors with line/column info, rendered beautifully with miette.

Week 35 — Performance & Profiling

Concepts
cargo flamegraph and perf
criterion benchmarks: statistical rigor
Cache-friendly data layouts (struct of arrays vs. array of structs)
SIMD: std::arch for platform-specific intrinsics (stable); std::simd portable SIMD is nightly-only as of 1.95
wide crate as the stable alternative for portable SIMD
Avoiding allocations in hot paths
Profile-guided optimization (PGO)
Exercises
1.
Profile the word counter with cargo flamegraph and identify the hot path
2.
Rewrite a struct-of-arrays vs. array-of-structs and benchmark
3.
Use Cow<str> to avoid cloning in a string processing function
4.
Pre-allocate a Vec with with_capacity and benchmark vs. growing
Mini-Project Optimize a matrix multiplication implementation: start naive, apply cache tiling, benchmark each step.

Week 36 — Algorithms: Sorting & Searching

Concepts
Implement sorting algorithms in idiomatic Rust: Bubble, Insertion, Selection, Merge, Quick, Heap, Radix
Binary search (iterative & recursive)
Two-pointer technique
Rust's sort, sort_unstable, sort_by, sort_by_key
Sorting custom types with Ord, PartialOrd
Exercises
1.
Implement merge sort generically over T: Ord
2.
Implement quicksort with 3-way partitioning
3.
Implement binary search returning Result<usize, usize> (like std)
4.
Sort a vector of structs by multiple fields using sort_by_key
Mini-Project Benchmark all 7 sorting algorithms against sort_unstable on arrays of size 100, 1K, 10K, 100K.

Week 37 — Algorithms: Data Structures

Concepts
Implementing from scratch:
Stack, Queue, Deque
Binary Search Tree (BST)
AVL Tree (self-balancing)
Heap (min-heap, max-heap)
Trie
Using Rust's ownership model to safely implement linked structures
Exercises
1.
Implement a BST with insert, search, delete, and in-order traversal
2.
Implement a MinHeap<T: Ord> with push and pop
3.
Implement a Trie for string prefix search
4.
Implement an AVL tree with rotation
Mini-Project Build a priority task scheduler backed by a min-heap, where tasks have priorities and deadlines.

Week 38 — Algorithms: Graph Algorithms

Concepts
Graph representations: adjacency list (Vec<Vec<usize>>), adjacency matrix, edge list
BFS and DFS with explicit stacks/queues
Dijkstra's shortest path
Bellman-Ford
Floyd-Warshall
Topological sort
Union-Find (Disjoint Set Union)
Exercises
1.
Implement BFS and DFS on a general graph
2.
Implement Dijkstra using BinaryHeap (Rust's priority queue)
3.
Implement topological sort using Kahn's algorithm
4.
Implement Union-Find with path compression and union by rank
Mini-Project Build a dependency resolver: given a list of packages with dependencies, output the build order using topological sort.

Week 39 — Algorithms: Dynamic Programming & Recursion

Concepts
Memoization vs. tabulation
Classic DP problems: Fibonacci, LCS, LIS, Knapsack, Coin Change, Edit Distance
DP on trees and graphs
Divide and conquer
Backtracking (N-Queens, Sudoku solver)
Exercises
1.
Implement LCS (Longest Common Subsequence) with tabulation
2.
Implement 0/1 Knapsack
3.
Solve N-Queens using backtracking
4.
Implement the Sudoku solver using backtracking + constraint propagation
Mini-Project Implement a diff algorithm (like diff) using LCS that shows added/removed lines between two texts.

Week 40 — Algorithms: Strings & Bit Manipulation

Concepts
KMP (Knuth-Morris-Pratt) pattern matching
Rabin-Karp rolling hash
Suffix arrays
Bit manipulation tricks
Bloom filters
std::collections::HashSet for deduplication vs. Bloom filter
Exercises
1.
Implement KMP string search
2.
Implement a rolling hash and use it for Rabin-Karp
3.
Implement a Bloom filter using multiple hash functions
4.
Solve classic bit manipulation problems: count set bits, detect power of 2, bit reversal
Mini-Project Build a fast substring search tool that reads a file and searches for a pattern using KMP, benchmarked against str::contains.

Phase 4 — Expert (Weeks 41–52)

Week 41 — Embedded & No-Std Rust

Concepts
#![no_std] and the core crate
#![no_main] and custom entry points
alloc crate for heap in no-std
Writing a minimal Rust program for bare metal
Embedded HAL traits
QEMU simulation for ARM targets
Exercises
1.
Write a #![no_std] library crate that compiles for thumbv7em-none-eabihf
2.
Implement a no_std version of a data structure using only core
3.
Write a panic handler for embedded targets
4.
Set up a QEMU + cortex-m quickstart project
Mini-Project Write a bare-metal blinky program for STM32 (or QEMU) using the embedded-hal abstractions.

Week 42 — WebAssembly with Rust

Concepts
Compiling Rust to wasm32-unknown-unknown
wasm-bindgen — Rust JavaScript interop
wasm-pack — packaging and publishing
Passing complex types across the WASM boundary
web-sys and js-sys
Performance considerations for WASM
Exercises
1.
Compile a Rust function to WASM and call it from JavaScript
2.
Use wasm-bindgen to expose a struct with methods to JS
3.
Access DOM APIs from Rust using web-sys
4.
Benchmark a compute task: Rust/WASM vs. pure JavaScript
Mini-Project Build a Rust/WASM Conway's Game of Life rendered in the browser canvas using web-sys.

Week 43 — Building CLI Applications

Concepts
clap (v4) — argument parsing: commands, subcommands, flags, values
indicatif — progress bars and spinners
console / crossterm — terminal styling and raw mode
dialoguer — interactive prompts
Reading from stdin, writing to stdout/stderr
Exit codes and error reporting in CLIs
Exercises
1.
Build a CLI with a subcommand structure using clap derive API
2.
Add a progress bar to a long-running computation
3.
Implement an interactive confirmation prompt
4.
Read piped input from stdin and process it line by line
Mini-Project Build a fully-featured todo CLI: add, list, complete, delete tasks, stored in a JSON file, with colored output and fuzzy search.

Week 44 — Building Web Services

Concepts
axum web framework: routing, handlers, extractors
serde + JSON request/response bodies
State management in axum (State<T>)
Middleware with tower
Database access with sqlx (PostgreSQL/SQLite)
Authentication patterns (JWT basics)
Exercises
1.
Build a REST API with CRUD endpoints using axum
2.
Add database persistence with sqlx and SQLite
3.
Implement request validation and structured error responses
4.
Add JWT authentication middleware
Mini-Project Build a task management REST API: users, tasks, assignments — with axum + sqlx + JWT auth.

Week 45 — Networking & Protocols

Concepts
tokio::net: TCP, UDP
Implementing a simple protocol from scratch (length-prefixed messages)
tokio-tungstenite — WebSockets
quinn — QUIC protocol
Protocol Buffers with prost
gRPC with tonic
Exercises
1.
Implement a TCP echo server and client
2.
Build a simple chat server using WebSockets
3.
Define a protobuf schema and generate Rust types
4.
Implement a gRPC service with tonic
Mini-Project Build a distributed key-value store with TCP transport and a simple text-based protocol (GET, SET, DEL commands).

Week 46 — Parallel Computing

Concepts
rayon — data parallelism, parallel iterators
Work-stealing scheduler (rayon's model)
rayon::join and rayon::scope
Parallel sort, map, filter
Portable SIMD: wide crate (stable) or std::simd (nightly-only in 1.95; do not confuse with std::arch which is stable)
packed_simd is unmaintained — use wide or std::simd instead
Amdahl's law and practical parallelism limits
Exercises
1.
Parallelize a prime sieve using rayon::par_iter
2.
Use rayon::join to implement parallel merge sort
3.
Benchmark parallel vs. sequential matrix multiplication
4.
Implement parallel prefix sum (scan)
Mini-Project Build a parallel image processing pipeline: read a PNG, apply filters (grayscale, blur) in parallel using rayon and image crate.

Week 47 — Compiler Plugins & Rustc Internals (Overview)

Concepts
How rustc works: parsing → HIR → MIR → LLVM IR → machine code
MIR (Mid-level Intermediate Representation)
Borrow checker implementation (Polonius — next-gen borrow checker, opt-in via Z polonius on nightly; NLL is the stable default)
Custom lint passes: rustc_plugin is deprecated; use dylint or compiler driver approach (nightly)
cargo-expand for inspecting macro expansion
Miri — executing code in an interpreter for UB detection
Exercises
1.
Run cargo expand on a complex macro and study the output
2.
Run cargo miri test on a program with intentional UB
3.
Write a custom clippy lint (using dylint)
4.
Inspect MIR output with rustc --emit mir
Mini-Project Write a custom clippy-style lint using dylint that catches a project-specific anti-pattern.

Week 48 — Design Patterns in Rust

Concepts
Creational: Builder, Factory, Singleton (using OnceLock)
Structural: Newtype, Facade, Decorator (via Deref)
Behavioral: Strategy (via trait objects or fn pointers), Observer (event system), Command
Rust-specific: RAII, typestate, extension traits
Anti-patterns: unwrap abuse, Arc<Mutex<T>> overuse, premature optimization
Exercises
1.
Implement the Builder pattern with compile-time required-field enforcement
2.
Implement the Observer pattern with Fn callbacks stored in a Vec
3.
Implement a command queue (undo/redo) system
4.
Implement a lazy singleton using std::sync::OnceLock
Mini-Project Refactor the task management system from Week 44 to apply three design patterns explicitly, documenting why each was chosen.

Week 49 — Security & Cryptography

Concepts
ring and rust-crypto ecosystem
Hashing: SHA-256, SHA-3 using sha2, sha3
HMAC, AEAD (AES-GCM) with aes-gcm
Asymmetric cryptography: RSA, Ed25519 with ed25519-dalek
Constant-time comparisons (timing attack prevention)
Secure random numbers with rand + OsRng
Exercises
1.
Hash a file with SHA-256 and verify integrity
2.
Encrypt/decrypt data using AES-GCM
3.
Generate an Ed25519 key pair and sign/verify a message
4.
Implement a password hashing scheme using argon2
Mini-Project Build a secrets manager CLI: store encrypted key-value pairs in a file, unlocked by a master password (Argon2 + AES-GCM).

Week 50 — Observability & Production Readiness

Concepts
tracing crate — structured, async-compatible logging
Spans, events, fields, subscribers
tracing-subscriber with JSON output for log aggregation
Metrics with metrics crate + Prometheus exporter
Health check endpoints
Graceful shutdown patterns
Configuration management with config crate
Exercises
1.
Instrument an async application with tracing spans at key operations
2.
Add Prometheus metrics (request count, latency histogram) to the axum API
3.
Implement a /health endpoint that checks database connectivity
4.
Implement graceful shutdown that drains in-flight requests
Mini-Project Add full observability to the task management API: structured logs, Prometheus metrics, health checks, and graceful shutdown.

Week 51 — Capstone Project (Part 1): Design & Architecture

Concepts
System design in Rust: choosing the right concurrency model
API design for library crates (ergonomics, safety, future-proofing)
Error handling strategy for large systems
Dependency selection criteria
Performance budgeting
Documentation-driven development
Capstone Project: Distributed Task Queue (like a mini Celery)
This week: Design
Define the architecture: broker, workers, client library
Choose communication protocol (TCP + custom protocol)
Define the API (ergonomic client, safe worker registration)
Plan error handling, retries, and dead-letter queues
Write the architecture document and API spec

Week 52 — Capstone Project (Part 2): Implementation & Review

Implementation
Broker: async TCP server, job queue (tokio::sync::mpsc), persistence (SQLite via sqlx)
Worker: async task executor, registering handlers by name, retry logic
Client library: ergonomic API, typed job submission
Observability: tracing instrumentation throughout
Tests: unit tests for core logic, integration tests for the full pipeline
Benchmarks: throughput (jobs/second), latency distribution
Deliverables
1.
Fully working distributed task queue in a Cargo workspace
2.
README with architecture diagram and usage examples
3.
Benchmark report comparing throughput under N worker threads
4.
Retrospective: what Rust features were essential, what was hardest

Reference: Topic Index

Topic
Primary Week
Revisited
Ownership
4
5, 6, 15, 25
Borrowing & References
5
6, 14, 26
Lifetimes
6
26
Traits (Rust's polymorphism / "inheritance")
11
12, 13, 27
Mutex
17
18, 33
Semaphore
18
33
Condvar / Monitor pattern
18
Channels
19
33
Atomics
20
Async/Await
21
22, 33
Unsafe Rust
25
31, 32
Algorithms
36–40
46
Macros
28, 29
FFI
31
41
WebAssembly
42
Concurrency Patterns
16–20
33, 46

Recommended Resources

Books

The Rust Programming Language (the Book) — https://doc.rust-lang.org/book/
Rust for Rustaceans — Jon Gjengset (intermediate/advanced)
Programming Rust — Blandy & Orendorff (comprehensive reference)
Rust Atomics and Locks — Mara Bos (concurrency deep dive)

Practice

Exercism Rust track — https://exercism.org/tracks/rust
LeetCode (use Rust as your language)
Advent of Code (past years, in Rust)

Community

Official Rust Forum — https://users.rust-lang.org
This Week in Rust — weekly newsletter
Curriculum version: 1.1 — Rust 1.95.0 stable (2021 Edition) — Reviewed 2026-05
Nightly-only features as of 1.95.0 (mentioned in curriculum for awareness, not required for exercises unless noted): Allocator trait (Week 32), std::simd portable SIMD (Weeks 35, 46), Polonius borrow checker (Week 47), complex const generic expressions (Week 30). All other content targets stable Rust unless explicitly marked.

안녕하세요

관련 기술 문의와 R&D 공동 연구 사업 관련 문의는 “glory@keti.re.kr”로 연락 부탁드립니다.

Hello

For technical and business inquiries, please contact me at “glory@keti.re.kr”