Section 1: Lab: Getting Started with Rust and Cargo
- What Rust is good for, and how it differs from C++, Go and garbage-collected languages
- Installing with rustup, the six-week release cycle and the 2024 edition
- cargo new, build, run, check and cargo build --release
- Lab: a first program formatted with rustfmt and checked with Clippy
Section 2: Data Types and Control Flow
- Variables, mut, shadowing and type inference
- String versus &str and working with UTF-8 text, including Thai
- if, loop, while, for and let chains in the 2024 edition
- Lab: a shipping cost calculator driven by user input
Section 3: Ownership, Borrowing and Lifetimes
- How move, clone and copy differ
- &T and &mut T references and the borrow checker's rules
- Slices and an introduction to lifetimes in functions
- Lab: fix code that will not compile by reading the compiler's messages
Section 4: Lab: Structs, Enums and Pattern Matching
- Structs, methods and associated functions
- Enums that carry data, and Option in place of null
- match, if let and let-else
- Lab: an order data model with its status expressed as an enum
Section 5: Systematic Error Handling
- panic versus Result, and when to use each
- The ? operator for propagating errors
- Custom error types with thiserror, and anyhow at the application level
- Lab: read a CSV file and report errors people can understand
Section 6: Lab: Traits, Generics, Closures and Iterators
- Traits in place of class inheritance, and standard traits such as Debug, Display and From
- Generics and trait bounds
- Closures and iterators: map, filter, fold and collect
- Lab: summarise sales from a list of orders with iterators