Learning Rust fundamentals through hands-on examples and exercises.
- In Rust, crate can only define 1 library (
lib.rs), but can define multiple binaries - Turbofish syntax (
::<>) - The
?operator at the end of a function call returns the error if it occurs.
fn my_fun(x: i32) -> Result<(), Error> {
x?;
Ok(())
}This repository contains practical Rust projects and notes as I learn the language. Each project focuses on specific Rust concepts like ownership, borrowing, structs, traits, and the module system.
- Rust (latest stable version)
- Cargo (comes with Rust)
Navigate to any project directory and run:
# Navigate to a project
cd bank # or cd deck
# Run the project
cargo run
# Run without debug info (quiet mode)
cargo run -q
# Build without running
cargo build# Add a crate
cargo add <crate-name>
# Remove a crate
cargo remove <crate-name>- Ownership & Borrowing: Understanding Rust's memory management model
- Structs & Implementations: Creating custom data types and their associated functions
- References: Working with
&(immutable) and&mut(mutable) references - Traits: Using derive attributes and implementing traits
- Vectors: Dynamic arrays and collection manipulation
- Modules & Crates: Organizing code and using external dependencies
- Master Rust's ownership system
- Understand the borrow checker
- Learn idiomatic Rust patterns
- Build practical applications
- Explore the Rust ecosystem
This is a learning repository, so code may not be production-ready. Each project includes comments explaining the concepts being demonstrated.
This is a personal learning project. Feel free to use it for your own learning purposes.