Rust
Memory safety with maximum speed
Learn Rust from scratch: from your first program with rustup and Cargo to variables, functions and Rust's central idea — the ownership and borrowing rules. Then you will write safe, fast code with structs, enums, error handling, collections, iterators, traits and generics. At the end of the course you will work with smart pointers and threads and build a command-line tool with tests.
Course content
Rust basics
BeginnerInstall Rust, run your first program with Cargo and get to know variables, types, functions, conditions and loops.
- 1What is Rust? Your first program and CargoLearn why Rust was created and how it keeps memory safe without a garbage collector, install it with rustup and run your first project with Cargo.14 min
- 2Variables, mutability and typesCreate variables with `let` and `mut`, use shadowing, and learn Rust's scalar types (integers, floats, `bool`, `char`) and compound types (tuples and arrays).16 min
- 3Functions, expressions and control flowWrite functions, understand the difference between expressions and statements, use `if` as an expression that returns a value, and apply `loop`, `while` and `for` together with ranges.15 min
Ownership, custom types and errors
IntermediateMaster the ownership and borrowing rules, build structs and enums, and handle errors with `Result` and `?`.
- 4Ownership, borrowing and slicesLearn Rust's most important idea: every value has one owner. Understand moves, `&` and `&mut` references, the borrowing rules, slices and the difference between `String` and `&str`.22 min
- 5Structs, methods, enums and matchCreate your own types: structs with fields, methods in an `impl` block, enums with variants, handling them with `match`, and `Option` instead of `null`.20 min
- 6Error handling: panic, Result and ?Tell unrecoverable errors (`panic!`) from recoverable ones (`Result`), understand the risks of `unwrap` and `expect`, write short code with the `?` operator and create your own error type.18 min
Collections and generic code
IntermediateWork with `Vec`, `HashMap`, closures and iterators, and write reusable code with traits, generics and lifetimes.
- 7Collections, closures and iteratorsStore data in `Vec` and `HashMap`, write closures, and turn loops into short, readable chains with iterator methods such as `map`, `filter` and `collect`.18 min
- 8Traits, generics and lifetimesDefine shared behaviour with traits, write generic functions with trait bounds, use `impl Trait` and `#[derive]`, and understand the basics of lifetime annotations.20 min
Advanced Rust and a real project
AdvancedUse smart pointers, threads, channels and `Arc<Mutex<T>>`, then build a complete CLI tool with modules, crates.io and tests.
- 9Smart pointers and concurrencyLearn the smart pointers `Box`, `Rc` and `RefCell`, then write parallel code without data races using threads, channels and `Arc<Mutex<T>>`.22 min
- 10Modules, Cargo and a project: a word counterSplit code into modules and crates, add dependencies from crates.io, write tests with `cargo test` and use everything you have learned to build a command-line tool that counts the words in a text file.22 min