Skip to content

Foufou-exe/traine-rust

Repository files navigation

🦀 Learning Rust - Traine Rust

EN | FR

Welcome to this repository dedicated to learning the Rust programming language. This project is structured as a progressive journey, starting from fundamental concepts to advanced topics like concurrency and memory management.

Each exercise is designed to isolate a specific concept, with detailed explanations and heavily commented source code.

📂 Course Structure

The repository is organized into thematic chapters to facilitate navigation:

  • Variables, immutability, and mutability (let, let mut).
  • Scalar types (integers, booleans, characters).
  • Functions and return values.
  • Control flow (if/else, loop, for).
  • Ownership and Move semantics.
  • Borrowing with immutable and mutable references.
  • Lifetimes and annotations.
  • Structures (struct) and method implementations (impl).
  • Enumerations (enum) and Pattern Matching (match).
  • The Option<T> enum for handling value absence.
  • Dynamic collections: Vectors (Vec<T>) and HashMap.
  • Recoverable error handling with Result<T, E>.
  • Using unwrap and expect.
  • Code organization with modules (mod, pub).
  • Traits (Interfaces) and Generics.
  • Closures and functional iterators.
  • Smart Pointers (Box<T>).
  • Multi-threading with std::thread.
  • Inter-thread communication via channels (mpsc).
  • Writing and executing unit tests.
  • Introduction to async with Tokio (async/.await).
  • Concurrent task management (join!, select!, spawn).
  • Shared state synchronization (Arc, Mutex).
  • Async communication channels (mpsc).
  • Non-blocking I/O (Files).

🚀 How to use this repo

Prerequisites

  • Have Rust installed (including cargo).

Running an exercise

This repository is configured as a Cargo Workspace. You can run any exercise directly from the root without changing directories:

# Example to run exercise 1
cargo run -p exo1

# Example to run exercise 10
cargo run -p exo10

Running tests

To verify your solutions (especially for exercise 28):

# Run tests for a specific package
cargo test -p exo28

# Run all workspace tests
cargo test --workspace

📝 Documentation

Each exercise has its own README.md describing the learning objectives and key takeaways. The source code is commented to explain the "why" behind each Rust instruction.


Safe travels in the land of memory safety! 🦀

About

A progressive, bilingual (EN/FR) roadmap to master Rust. From basics to Async Tokio, featuring 36+ exercises and real-world case studies

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages