Learn Rust
20 lessons to master Rust — from installation to publishing your first crate.
Getting started
Install Rust, write your first program, and learn the basics.
Installing Rust
rustup, cargo, rustc
Hello, World!
cargo new, cargo run
Variables and types
let, mut, const, types
Functions and control flow
fn, if, loop, match
Memory Safety
Why Rust prevents memory bugs at compile time
Ownership & borrowing
Understand Rust's unique memory model.
Ownership
move, copy, drop
References and borrowing
&, &mut, borrowing rules
Slices
&str, &[T], string slices
Lifetimes
'a, lifetime annotations
Stack vs Heap
How Rust manages memory allocation
Data structures
Structs, enums, Option, Result and collections.
Structs
struct, impl, methods
Enums and pattern matching
enum, match, if let
Option and Result
Option<T>, Result<T,E>, ?
Collections
Vec, HashMap, iterators
Rust vs C/C++
Comparing memory safety approaches
Code organization
Modules, traits, generics and error handling.
Modules and crates
mod, use, pub, crate
Traits
trait, impl, dyn
Generics
<T>, where, bounds
Error handling
Result, ?, custom errors
Zero-cost abstractions
How Rust gives safety without runtime cost
Practical project
Build a real CLI tool from scratch.