RUST · 22 lessons
Ownership · Borrowing · Lifetimes · Traits · Async — all with Cargo
22 lessons covering variables/type inference, ownership·borrowing·lifetimes, traits·pattern matching, error handling, and concurrency / async-await in Rust. Each lesson includes the full tutorial, runnable Cargo examples, a homework task and a reference solution.
Part 1: Basics
5 lessons
Getting Started with Rust
Installing Rust, creating a cargo project and running your first program
Variables & Types
Variable bindings, mutability, primitive types and type inference
Primitive Types in Depth
Scalar and compound types, tuples and fixed-size arrays
Control Flow
Conditionals, loops and pattern matching with match
Functions
Defining functions, parameters, return types and expressions
Part 2: Ownership, Borrowing & Lifetimes
5 lessons
Ownership
Ownership rules, moves and the Copy/Clone traits
Borrowing & References
References, immutable and mutable borrows, and compile-time checks
Slices
Slice types and string/array slicing
Lifetimes
Lifetime annotations and static lifetimes
String & &str
Owned vs borrowed strings and conversion methods
Part 3: Structs, Enums & Traits
4 lessons
Structs
Defining structs, creating instances, methods and associated functions
Enums & Option
Defining enums, the Option type and pattern matching
Pattern Matching
Match expressions, destructuring and match guards
Traits
The trait system, generic bounds and standard traits
Part 4: Error Handling, Panics & Custom Errors
4 lessons
Result & Option
Result and Option types, unwrapping methods and the ? operator
The ? Operator
How ? propagates errors and converts them with From
Panics
Raising panics, backtraces and panic hooks
Custom Errors
Defining custom error types and implementing the Error trait
Part 5: Cargo, Testing, Concurrency & Async
4 lessons
Modules & Cargo
The module system, visibility, Cargo configuration and workspaces
Testing
Writing and running tests, coverage and mocking
Concurrency
Spawning threads, message passing and shared-state synchronisation
async/await
Asynchronous programming, futures, executors and select!