Skip to content

Latest commit

 

History

History
320 lines (249 loc) · 11 KB

File metadata and controls

320 lines (249 loc) · 11 KB

Rust Learning Roadmap - Exercism Exercises

A comprehensive journey through Rust programming concepts using Exercism's structured learning path, focusing on memory safety, performance, and systems programming.

📊 Progress Overview

  • Total Exercises: 98
  • Completed: 1 ✅
  • In Progress: 0 🔄
  • Available: 97 📋
  • Locked: 0 🔒
  • Progress: 1.0%

🎯 Current Status

✅ Completed Exercises (1)

Exercise Concept Difficulty Description
Hello World Basics, Functions Easy The classical introductory exercise

📋 Ready to Start

Exercise Concept Difficulty Description
Reverse String Strings, Iterators Recommended Reverse a given string

🗺️ Rust Learning Path & Concepts

🟢 Mastered Concepts

  • Basics - Project structure, cargo, basic syntax
  • Functions - Function definition and return values

🔴 Core Rust Concepts to Learn

Foundation Level

  • 📋 Variables & Mutability - let, mut, shadowing
  • 📋 Data Types - Scalars, compounds, type annotations
  • 📋 Functions - Parameters, return values, expressions vs statements
  • 📋 Control Flow - if, loop, while, for
  • 📋 Comments - Documentation and code comments

Ownership System (Rust's Unique Feature)

  • 📋 Ownership - Move semantics, stack vs heap
  • 📋 References & Borrowing - &, &mut, borrowing rules
  • 📋 Slices - String slices, array slices
  • 📋 Lifetimes - Lifetime annotations, lifetime elision

Data Structures

  • 📋 Structs - Definition, instantiation, methods
  • 📋 Enums - Variants, Option<T>, Result<T,E>
  • 📋 Pattern Matching - match, if let, destructuring
  • 📋 Collections - Vec<T>, HashMap<K,V>, String

Error Handling

  • 📋 Result<T,E> - Recoverable errors
  • 📋 Option<T> - Null value handling
  • 📋 panic! - Unrecoverable errors
  • 📋 Error Propagation - ? operator

Advanced Concepts

  • 📋 Traits - Defining shared behavior
  • 📋 Generics - Generic functions, structs, enums
  • 📋 Iterators - Iterator trait, lazy processing
  • 📋 Closures - Anonymous functions, capturing environment
  • 📋 Smart Pointers - Box<T>, Rc<T>, RefCell<T>
  • 📋 Concurrency - Threads, message passing, shared state
  • 📋 Macros - Declarative and procedural macros

🎯 Next Priority Exercises

Easy Exercises - Foundation Building

  1. Reverse String - String manipulation and iterators
  2. Gigasecond - Date/time handling with chrono
  3. Armstrong Numbers - Loops, mathematical operations
  4. Leap - Boolean logic and conditionals
  5. Raindrops - String formatting and conditionals
  6. Difference of Squares - Mathematical computations
  7. Grains - Exponential growth, large numbers
  8. Sum of Multiples - Iteration and filtering

Medium Exercises - Core Rust Concepts

  1. Clock - Structs, methods, time arithmetic
  2. Anagram - String processing, collections
  3. Space Age - Enums, pattern matching
  4. Sublist - Slices, comparison algorithms
  5. Luhn - String processing, validation algorithms

Hard Exercises - Advanced Rust Features

  1. Parallel Letter Frequency - Concurrency, threading
  2. Macros - Macro system, metaprogramming
  3. React - Advanced trait usage, event systems
  4. Circular Buffer - Memory management, unsafe code

📚 Exercise Categories

🟢 Beginner Track (Easy - 26 exercises)

Foundation concepts, basic Rust syntax, and simple problem-solving.

Key Concepts: Variables, functions, basic data types, control flow, simple pattern matching.

🟡 Intermediate Track (Medium - 66 exercises)

Rust's unique features, ownership system, and idiomatic patterns.

Key Concepts: Ownership, borrowing, lifetimes, traits, generics, error handling, collections.

🔴 Advanced Track (Hard - 6 exercises)

Complex systems programming, unsafe code, and advanced language features.

Key Concepts: Concurrency, macros, advanced trait usage, performance optimization.

🚀 Getting Started

Prerequisites

# Install Rust toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env

# Verify installation
rustc --version    # Should be 1.70+
cargo --version    # Package manager

# Install Exercism CLI
# Follow instructions at https://exercism.org/cli-walkthrough

Rust Project Structure

exercise-name/
├── Cargo.toml           # Project metadata and dependencies
├── README.md            # Exercise description
├── src/
│   └── lib.rs          # Your solution code
├── tests/
│   └── exercise.rs     # Test file
└── .exercism/          # Exercism metadata

Running Exercises

# Navigate to exercise directory
cd exercism/rust/[exercise-name]

# Run tests
cargo test

# Run tests with output
cargo test -- --nocapture

# Check code without running tests
cargo check

# Format code
cargo fmt

# Lint code
cargo clippy

# Submit solution
exercism submit src/lib.rs

Useful Cargo Commands

# Create new exercise (if needed)
cargo new exercise-name --lib

# Add dependencies
cargo add dependency-name

# Build project
cargo build

# Run specific test
cargo test test_name

# Show test output
cargo test -- --show-output

📖 Learning Resources

Official Rust Resources

Community Resources

Specialized Learning

🎯 Learning Goals

Foundation Goals

  • Complete first 10 easy exercises
  • Understand ownership and borrowing
  • Master basic error handling with Result and Option
  • Learn pattern matching with match
  • Implement basic structs and methods

Intermediate Goals

  • Complete 25 exercises across all difficulties
  • Master traits and generics
  • Understand lifetimes and lifetime annotations
  • Implement custom iterators
  • Handle complex error scenarios

Advanced Goals

  • Complete 50+ exercises including medium/hard
  • Master concurrent programming patterns
  • Write custom macros
  • Contribute to open-source Rust projects
  • Understand unsafe Rust when necessary

Long-term Vision

  • Complete all 98 Exercism exercises
  • Build substantial Rust projects
  • Mentor other Rust learners
  • Understand systems programming with Rust
  • Master performance optimization techniques

🧠 Rust-Specific Learning Tips

Memory Management

  • Rust's ownership system eliminates garbage collection
  • Understanding move semantics is crucial
  • Borrowing allows temporary access without ownership transfer
  • Lifetimes ensure references are valid

Error Handling Philosophy

  • Rust forces explicit error handling
  • Result<T,E> for recoverable errors
  • Option<T> for nullable values
  • panic! for unrecoverable errors

Performance Mindset

  • Zero-cost abstractions principle
  • Compile-time guarantees over runtime checks
  • Explicit over implicit operations
  • Memory safety without performance penalties

Common Beginner Challenges

  1. Fighting the Borrow Checker - Learn ownership patterns
  2. Lifetime Annotations - Understand when and why they're needed
  3. Pattern Matching - Embrace exhaustive matching
  4. Error Handling - Use ? operator effectively
  5. Trait System - Think in terms of behavior, not inheritance

📈 Progress Tracking

Concept Mastery Checklist

  • Ownership System - Core Rust concept
  • Pattern Matching - Powerful control flow
  • Traits - Shared behavior definition
  • Error Handling - Robust error management
  • Iterators - Functional programming patterns
  • Concurrency - Safe parallel programming
  • Macros - Metaprogramming capabilities

Skill Development Areas

  • Systems Programming - Low-level control with high-level safety
  • Performance Engineering - Writing efficient, fast code
  • API Design - Creating ergonomic, safe interfaces
  • Concurrent Programming - Fearless concurrency patterns
  • Memory Management - Understanding stack vs heap allocation

🔗 Quick Navigation


📝 Rust Learning Philosophy

"Rust empowers everyone to build reliable and efficient software. The language's design makes it easier to write programs that are both fast and safe, without sacrificing expressiveness."

Why Rust?

  • Memory Safety - Prevent segfaults and data races
  • Performance - Zero-cost abstractions, no garbage collector
  • Concurrency - Fearless concurrent programming
  • Expressiveness - Modern language features and syntax
  • Ecosystem - Growing collection of high-quality crates

Rust's Design Principles

  • Memory safety without garbage collection - Ownership system
  • Zero-cost abstractions - High-level features, low-level performance
  • Move semantics by default - Explicit copying when needed
  • Minimal runtime - Predictable performance characteristics
  • Prevent data races - Compile-time concurrency safety

Learning Approach

  • Embrace the Compiler - Rust's compiler is your teacher
  • Read Error Messages - They're incredibly helpful
  • Practice Ownership - Core to understanding Rust
  • Start Simple - Build complexity gradually
  • Join the Community - Rust has an welcoming community

Common Rust Patterns

  • RAII - Resource Acquisition Is Initialization
  • Builder Pattern - Constructing complex objects
  • Newtype Pattern - Type safety with wrapper types
  • State Machines - Encoding state with types
  • Iterator Chains - Functional data processing

Last Updated: December 2024
Next Review: After completing first 5 exercises
Focus: Building strong foundation in Rust fundamentals