Skip to content

tony/learning-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Learning Rust - Step-by-Step Courses

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.

πŸ“š Course Structure

This repository contains 14 specialized courses, each focusing on different aspects of Rust programming:

Foundation Courses

  • 000_example/ - Template and reference implementation showing all patterns
  • dsa_data_structures/ - Core Rust data structures (Vec, HashMap, BTree, etc.)
  • dsa_algorithms/ - Algorithm implementations from O(nΒ²) to O(log n)

Concurrency & Async

  • async/ - Asynchronous programming with futures and async/await

Command Line & Terminal UI

  • cli/ - Building command-line tools with argument parsing
  • tui/ - Terminal user interfaces with widgets
  • tui_mux/ - Build a tmux clone step-by-step
  • tui_editor/ - Create a basic text editor from scratch

Interoperability

  • lib_python/ - Python FFI with PyO3
  • lib_nodejs/ - Node.js native modules

Systems Programming

  • unix_clones/ - Recreate classic Unix utilities
  • lint/ - Build a basic Rust linter
  • db_sqlite/ - Database programming with SQLite
  • ai_mcp/ - Model Context Protocol implementation

🎯 Learning Philosophy

Each course follows a consistent pattern:

  1. Progressive Difficulty - Start simple, build complexity gradually
  2. Self-Contained Lessons - Each file is independently runnable
  3. Real-World Context - Every concept tied to practical applications
  4. Multiple Implementations - Show naive, idiomatic, and optimized versions
  5. Comprehensive Testing - Doctests, unit tests, integration tests, and benchmarks

πŸš€ Getting Started

Prerequisites

  • Rust 1.75+ (install via rustup)
  • Basic familiarity with terminal/command line

Quick Start

  1. Clone the repository:
git clone https://github.com/yourusername/learning-rust.git
cd learning-rust
  1. Build all courses:
cargo build --workspace
  1. Run tests to verify everything works:
cargo test --workspace --all-targets
cargo test --workspace --doc
  1. Start with the example course:
cd courses/000_example
cargo test
cargo run --example full_demo

πŸ“– How to Use This Repository

For Self-Study

  1. Start with 000_example to understand the pattern
  2. Choose a course based on your interests
  3. Read lessons sequentially (001, 002, 003...)
  4. Run the code and experiment with modifications
  5. Complete the exercises in each lesson
  6. Run tests to verify understanding

Lesson Structure

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

πŸ§ͺ Testing

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 --workspace

πŸ“Š Benchmarking

Performance-critical algorithms include benchmarks:

cd courses/dsa_algorithms
cargo bench

πŸ”§ Development

Adding New Lessons

  1. Follow the naming convention: XXX_topic.rs
  2. Use the documentation template from 000_example
  3. Include at least 3 doctests
  4. Add corresponding test file in tests/
  5. Update the course README

Code Quality

Before committing:

# Format code
cargo fmt --all

# Check lints
cargo clippy --workspace --all-targets -- -D warnings

# Verify tests
cargo test --workspace

πŸ“ Course Progression Map

graph 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]
Loading

πŸŽ“ Learning Paths

Path 1: Data Structures & Algorithms

  1. dsa_data_structures β†’ dsa_algorithms

Path 2: Systems Programming

  1. unix_clones β†’ cli β†’ db_sqlite

Path 3: Terminal Applications

  1. cli β†’ tui β†’ tui_mux or tui_editor

Path 4: Language Interop

  1. lib_python or lib_nodejs

Path 5: Async Programming

  1. async β†’ ai_mcp

πŸ“š Resources

Documentation

Tools Used

🀝 Contributing

Contributions are welcome! Please:

  1. Follow the established patterns
  2. Include comprehensive documentation
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Run clippy and rustfmt

πŸ“„ License

This project is designed for educational purposes. See LICENSE file for details.

πŸ™ Acknowledgments

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!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages