Skip to content

freddiehaddad/tokio-lessons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn Tokio

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

Prerequisites

  • Comfortable with Rust fundamentals (ownership, borrowing, traits, generics, error handling)
  • Basic understanding of async/await syntax in Rust

Assignments

# 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

Getting Started

Each assignment can be run with:

cargo run --bin hw1

Tests can be run with:

cargo test --bin hw6

NOTE: Replace hw1 with the assignment number (e.g., hw2, hw3, etc.).

Resources

  • 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

About

A collection of progressive assignments designed to teach asynchronous programming in Rust using Tokio.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages