Rust Learning Lab is a collection of short explanations, runnable examples, exercises, and small projects for learning Rust by writing code. It starts with the language basics, spends time on ownership and borrowing, and then moves into tooling, application design, concurrency, patterns, and project work.
The repository is intended for people learning Rust for the first time and for developers coming from Java, Python, Go, C++, or a similar language. Examples favour clarity over compactness so that the reason behind each Rust feature is visible in the code.
- Focused examples that can be compiled and changed independently
- Exercises built around common mistakes and compiler feedback
- Concept notes, key takeaways, and suggested experiments
- Cargo projects for command-line applications and larger examples
- Make targets for compiling standalone examples and generating rustdoc output
- Transition guides for developers arriving from other languages
The material is under active development. The foundations and intermediate modules are usable now; some advanced project folders are still planned or are being expanded. The roadmap records that distinction.
Install the stable Rust toolchain with rustup. You will need rustc, cargo,
rustfmt, clippy, Git, and Make. The included toolchain file
selects the required Rust channel and components.
Verify the installation:
rustc --version
cargo --versiongit clone https://github.com/SaumilP/rust-learning-lab.git
cd rust-learning-lab
cd 00-setup-and-basics/hello_world
cargo runIf you already know the basics, use the learning path to choose a suitable starting point.
| Module | Subject | Current role |
|---|---|---|
00-setup-and-basics |
Installation, variables, data types, and control flow | Starting point |
01-core-fundamentals |
Ownership, borrowing, lifetimes, functions, and errors | Core foundation |
02-standard-library |
Collections, strings, iterators, traits, and smart pointers | Core library skills |
03-tooling-and-quality |
Cargo, testing, documentation, debugging, and code quality | Development workflow |
04-simple-programs |
Small command-line programs and file processing | Applied practice |
05-cli-and-console-games |
Console I/O, game loops, state, and randomness | Applied practice |
06-intermediate-rust |
Modules, concurrency, async, macros, and deeper type-system work | Intermediate study |
06-advanced-functions |
Supplementary examples for generics, traits, enums, and ownership | Optional review |
07-advanced-concepts |
Networking, web APIs, WebAssembly, procedural macros, and performance | Advanced reference |
08-design-patterns |
Creational, structural, behavioural, and Rust-specific patterns | Pattern study |
09-mini-projects |
Multi-file programs that combine several concepts | Project practice |
10-real-world-rust |
Profiling, unsafe Rust, FFI, deployment, and organization | Production topics |
11-language-specific-tracks |
Rust guidance for Java, Python, Go, and C++ developers | Transition guides |
challenges |
Progressive practice and interview-style problems | Additional exercises |
Many concept modules contain standalone .rs files instead of Cargo packages.
Run their Makefile from the module directory:
cd 01-core-fundamentals
make list
make run EXAMPLE=control_flow/examples/loops.rs
make check
make cleanmake check verifies formatting, compiles the examples with warnings denied,
runs embedded tests, and generates rustdoc pages under build/docs/. Generated
files are temporary; make clean removes the complete build/ directory.
For a Cargo workspace or package, use Cargo from the directory containing its
Cargo.toml:
cd 04-simple-programs
cargo run -p calculator
cargo test --workspaceSome exercises are deliberately incomplete and should not compile until you repair them. Read the exercise instructions before treating a compiler error as a repository defect.
- Read the topic's
README.mdandkey_takeaways.md. - Run the example without changing it.
- Predict the result of a small change, then test that prediction.
- Complete the related exercise using the compiler messages as feedback.
- Apply the topic in a program from modules 04, 05, or 09.
Continuous integration checks the tracked Cargo packages and the standalone examples used by the main learning modules. Local checks should be run before a pull request; the exact commands are documented in CONTRIBUTING.md.
Planned additions and known content gaps are listed in ROADMAP.md. For a compact sequence through the current material, see LEARNING_PATH.md.
Corrections, clearer explanations, new exercises, tests, and small focused examples are welcome. Please read CONTRIBUTING.md before opening a pull request. Community expectations are described in the Code of Conduct, and security reports should follow SECURITY.md.
This project is available under the MIT License.