This repository contains my complete Rust learning journey — from basics to advanced projects.
Rust is a modern systems programming language focused on speed, safety, and concurrency — without using a garbage collector.
It is used to build fast and reliable software like operating systems, games, web servers, and more.
Open your terminal or command prompt and run:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shThis will install:
rustc→ Rust compilercargo→ Build tool and dependency managerrustup→ Toolchain manager
After installation, restart your terminal and check versions:
rustc --version
cargo --versionRust needs a C compiler like GCC to compile some libraries.
-
Windows:
- Download and install MinGW-w64
- During installation, choose:
- Architecture: x86_64
- Threads: posix
- Exception: seh
- Add the
binfolder (e.g.,C:\Program Files\mingw-w64\...\bin) to your System PATH
-
Linux (Ubuntu/Debian):
sudo apt update sudo apt install build-essential
-
macOS:
xcode-select --install
Rust-Language-/
│
├── Individual Concept Files (e.g., 01_main.rs, 03_variables.rs, etc.) # Single .rs files for learning basics
│
├── 02_guess_game/ # Cargo project: Number guessing game
│ ├── Cargo.toml
│ └── src/
│ └── main.rs
│
├── 16_rust_package_demo/ # Cargo project: Library demo
│ ├── Cargo.toml
│ ├── Cargo.lock
│ └── src/
│ ├── lib.rs
│ └── main.rs
│
├── 18_project/ # Cargo project: Bank account simulation
│ ├── Cargo.toml
│ ├── Cargo.lock
│ └── src/
│ ├── lib.rs
│ ├── main.rs
│ └── bank/
│ ├── mod.rs
│ └── account.rs
│
└── README.md # This file
For individual .rs files (e.g., 01_main.rs):
rustc <filename>.rs
./<filename> # On Linux/Mac
<filename>.exe # On WindowsExample:
rustc 01_main.rs
./01_mainFor Cargo-based projects (e.g., 02_guess_game):
cd <project-folder>
cargo runTo build without running:
cargo buildTo build in release mode:
cargo build --releaseExample for 02_guess_game:
cd 02_guess_game
cargo runThis repository covers key Rust concepts through individual files and projects:
- Hello World and Basics (01_main.rs)
- Variables and Constants (03_variables.rs)
- Data Types, Arrays, Tuples (04_DataTypes.rs)
- Functions (05_Functions.rs)
- Control Flow (06_Control_flow.rs)
- Ownership (07_Ownership.rs)
- References and Borrowing (08_References_and_Borrowing.rs)
- The Slice Type (09_The_Slice.rs)
- Structs (10_struct.rs, 11_dbgMacro_Defining_and_Instantiating_Structs.rs, 12_Method_Syntax.rs)
- Enums and Match (13_The_Enum_and_Match_Types.rs, 14_Match_Control_flow.rs)
- Concise Control Flow (15_Let_if_Concise_Flow.rs)
- Modules (17_Defining_Modules_to_Control_Scope.rs)
- Vectors (19_Storing_Lists_of_Values_with_Vectors.rs)
- Strings (20_String_operation.rs)
- Hash Maps (21_Storing_Keys_with_Associated_Values_in_Hash_Maps.rs)
- Error Handling (22_error_with_panic.rs, 23_Recoverable_Errors_with_Result.rs)
- Traits (24_Traits.rs)
- Lifetimes (25_Validating_References_with_Lifetimes.rs)
- Projects: Guessing Game (02_guess_game), Package Demo (16_rust_package_demo), Bank Account (18_project)