Lessons
Variables, types, and control flow
let, mut, basic types (i32, f64, bool, char), if/else, loop, while, for, and pattern matching basics.
What to look for:
- Variables are immutable by default — use mut for mutability
- Type inference: Rust knows the type from context
- let x: i32 = 5 vs let x = 5 (inferred)
- for i in 0..5 range syntax
Ownership and move semantics
The three ownership rules, move vs copy, clone(), and when memory is freed.
Prerequisite: Lesson 1
What to look for:
- The three ownership rules — memorise them
- Move: String assignment transfers ownership
- Copy: i32, f64, bool are copied silently
- When drop() is called — end of scope
Borrowing and references
& immutable references, &mut mutable references, the borrow rules, and slices.
Prerequisite: Lesson 2
What to look for:
- Borrow rule: many & OR one &mut, never both
- &str vs String — prefer &str in function parameters
- Slices: &s[0..5] — reference to part of a collection
- The borrow checker error messages are informative — read them fully
Structs, enums, and impl
Struct definition, impl blocks with methods and associated functions, enums with data, and derive macros.
Prerequisite: Lesson 3
What to look for:
- impl User { fn new(...) -> Self } — constructor pattern
- #[derive(Debug)] — free debug printing
- Enum variants can hold data — this is not a C enum
- match must be exhaustive — all variants or _ wildcard
Option and Result
Option
Prerequisite: Lesson 4
What to look for:
- Option replaces null — Some(value) or None
- Result replaces exceptions — Ok(value) or Err(error)
- ? operator: propagate error up the call stack
- unwrap() is a deliberate panic choice — not error handling
How to use this track: Each lesson links to the Codex Rust reference page. Use reading level tabs. Rust borrow checker errors are the lesson — read them carefully. Practice at play.rust-lang.org.
Track quiz
4 questions to check your understanding.
In Rust, what does let x = String::from("hello"); let y = x; do to x?
How many mutable references to the same data can exist at one time?
What does Option
What does the ? operator do when applied to a Result?