Welcome to the Rust Programming Tutorial! 🚀
This repository contains examples and notes organized by chapters to help you learn Rust step-by-step, starting from primitive data types to complex collections and error handling.
Understand the basic data types that Rust uses to handle:
- Numbers (integers, floating-points)
- Booleans
- Characters
Explore complex data structures:
- Tuples — group multiple values of different types.
- Arrays — fixed-size collections of elements of the same type.
Learn how to define and use functions, and understand Rust's approach to:
- Code organization
- Code reuse
Dive into Rust's unique memory management system:
- Manage resources safely without a garbage collector.
- Understand how ownership works.
Expand on memory safety:
- Create references to variables without taking ownership.
- Understand mutable and immutable borrowing.
Discover how Rust handles:
- Immutable variables (by default)
- Mutability when needed
Work with constants:
- Immutable by default
- Never mutable after being set
- Used for safe, fixed values
Enhance flexibility in variable handling:
- Redefine a variable with the same name.
- Understand how shadowing differs from mutability.
Master the art of documentation:
- Write clear and useful comments.
- Help future readers (and yourself) understand the code better.
Learn decision-making in Rust using:
if
else if
else
statements
Explore the three looping constructs:
loop
— runs indefinitely until stopped.while
— runs while a condition holds true.for
— iterates over ranges, arrays, and collections efficiently.
Create your own complex types:
- Bundle related data into structs.
- Learn about immutability in structured data.
Work with enums:
- Define a type by enumerating its possible values (variants).
- Handle related types safely and cleanly.
Understand Rust’s safe error-handling philosophy:
- Use
Result
andOption
types to manage errors and absence of values predictably.
Manage groups of data efficiently using:
- Vectors — dynamic arrays.
- Strings — flexible, UTF-8 encoded text storage.
- HashMaps — key-value pair storage for fast lookup.
Each chapter folder contains:
- Code examples
- Notes and explanations
- Practice problems (in some chapters)
You can navigate through the chapters sequentially or jump directly to the topic you want to learn.
If you are new to Rust:
- Install Rust from https://rustup.rs/
- Use
cargo run
to run examples after navigating to a project folder.
Feel free to fork, modify, or suggest improvements!
Let's build a great resource for learning Rust together.
This project is open-source and available under the MIT License.
Would you also like me to help you create a simple file/folder structure example for this repo (like /Chapter_01_Primitives/main.rs
, etc.)? It can make it even easier for you to organize your GitHub repo. 🚀