A comprehensive collection of progressive Rust courses designed to teach Rust concepts through hands-on, incremental lessons. Each course builds on fundamental concepts with real-world examples, comprehensive documentation, and extensive testing.
This repository contains 14 specialized courses, each focusing on different aspects of Rust programming:
000_example/- Template and reference implementation showing all patternsdsa_data_structures/- Core Rust data structures (Vec, HashMap, BTree, etc.)dsa_algorithms/- Algorithm implementations from O(nΒ²) to O(log n)
async/- Asynchronous programming with futures and async/await
cli/- Building command-line tools with argument parsingtui/- Terminal user interfaces with widgetstui_mux/- Build a tmux clone step-by-steptui_editor/- Create a basic text editor from scratch
lib_python/- Python FFI with PyO3lib_nodejs/- Node.js native modules
unix_clones/- Recreate classic Unix utilitieslint/- Build a basic Rust linterdb_sqlite/- Database programming with SQLiteai_mcp/- Model Context Protocol implementation
Each course follows a consistent pattern:
- Progressive Difficulty - Start simple, build complexity gradually
- Self-Contained Lessons - Each file is independently runnable
- Real-World Context - Every concept tied to practical applications
- Multiple Implementations - Show naive, idiomatic, and optimized versions
- Comprehensive Testing - Doctests, unit tests, integration tests, and benchmarks
- Rust 1.75+ (install via rustup)
- Basic familiarity with terminal/command line
- Clone the repository:
git clone https://github.com/yourusername/learning-rust.git
cd learning-rust- Build all courses:
cargo build --workspace- Run tests to verify everything works:
cargo test --workspace --all-targets
cargo test --workspace --doc- Start with the example course:
cd courses/000_example
cargo test
cargo run --example full_demo- Start with
000_exampleto understand the pattern - Choose a course based on your interests
- Read lessons sequentially (001, 002, 003...)
- Run the code and experiment with modifications
- Complete the exercises in each lesson
- Run tests to verify understanding
Each lesson file contains:
- Context - Real-world scenario explaining why this matters
- Concepts - What you'll learn
- Code - Progressive implementations
- Doctests - Inline executable examples
- Exercises - Practice problems
Example lesson structure:
//! # Lesson 002: Linear Search
//!
//! ## Context
//! In a product catalog, we need to find items...
//!
//! ## Concepts Covered
//! - Generic types
//! - Iterator patterns
//! - Performance analysis
Every lesson includes multiple levels of testing:
# Run all tests
cargo test --workspace
# Run doctests only
cargo test --workspace --doc
# Run specific course tests
cargo test -p courses_000_example
# Run with output
cargo test -- --nocapture
# Run benchmarks
cargo bench --workspacePerformance-critical algorithms include benchmarks:
cd courses/dsa_algorithms
cargo bench- Follow the naming convention:
XXX_topic.rs - Use the documentation template from
000_example - Include at least 3 doctests
- Add corresponding test file in
tests/ - Update the course README
Before committing:
# Format code
cargo fmt --all
# Check lints
cargo clippy --workspace --all-targets -- -D warnings
# Verify tests
cargo test --workspacegraph LR
A[000_example] --> B[dsa_data_structures]
B --> C[dsa_algorithms]
B --> D[async]
B --> E[cli]
E --> F[tui]
F --> G[tui_mux]
F --> H[tui_editor]
B --> I[unix_clones]
C --> J[lint]
B --> K[db_sqlite]
D --> L[ai_mcp]
B --> M[lib_python]
B --> N[lib_nodejs]
dsa_data_structuresβdsa_algorithms
unix_clonesβcliβdb_sqlite
cliβtuiβtui_muxortui_editor
lib_pythonorlib_nodejs
asyncβai_mcp
Contributions are welcome! Please:
- Follow the established patterns
- Include comprehensive documentation
- Add tests for new functionality
- Ensure all tests pass
- Run clippy and rustfmt
This project is designed for educational purposes. See LICENSE file for details.
Inspired by:
- The Rust community's emphasis on documentation
- Step-by-step learning approaches in programming education
- Real-world application-driven teaching
Happy Learning! π¦
Start with courses/000_example/ to see the pattern, then dive into any course that interests you!