A collection of progressive assignments designed to teach asynchronous programming in Rust using Tokio. Each assignment builds on concepts from previous ones, gradually introducing new async primitives and patterns.
Each assignment file contains the full requirements and hints at the top. Try to
implement each one yourself before looking at the solution code in src/.
- Comfortable with Rust fundamentals (ownership, borrowing, traits, generics, error handling)
- Basic understanding of async/await syntax in Rust
| # | Name | Key Concepts |
|---|---|---|
| 1 | Concurrent Web Fetcher | tokio::spawn, JoinHandle, basic async error handling |
| 2 | Rate-Limited Task Queue | Semaphore, bounded concurrency, backpressure |
| 3 | Chat Server with Channels | TcpListener, broadcast channel, select! |
| 4 | Graceful Shutdown Orchestrator | CancellationToken, signal::ctrl_c, timeout |
| 5 | Producer-Consumer Pipeline | Bounded mpsc channels, multi-stage pipelines |
| 6 | Async Retry with Backoff | Async generics, tokio::time, #[tokio::test] |
| 7 | Connection Pool | Mutex, Semaphore, Deref/Drop, guard pattern |
| 8 | Custom Mini-Runtime (Bonus) | Future, Waker, RawWaker, Poll, Pin |
Each assignment can be run with:
cargo run --bin hw1Tests can be run with:
cargo test --bin hw6NOTE: Replace
hw1with the assignment number (e.g.,hw2,hw3, etc.).
- Tokio Tutorial — official walkthrough from setup to a working mini-Redis
- Tokio API Docs — reference for all modules and types
- mini-redis — a real-world example project using many of these patterns