Rust curriculum

 
 

A quick guide to some of the major Rust topics we’ll learn about in my Mastery sessions, organised by subject area. (See also my Go and Engineering curriculum pages.)

Introduction to Rust

  • What makes Rust special? We’ll talk about why Rust is not just a new language, but a whole new way of programming. What are Rust’s key strengths, and what kind of problems does Rust solve best? Should existing code be rewritten in Rust—and how?

  • Installation and getting started: The rustup tool, Cargo, and enabling Rust support in IDEs such as VS Code, Cursor, and Zed. Setting up your Rust dev environment. Useful learning and training resources for Rust.

  • The Rust language: What kind of programming language is Rust? How does it compare to Go, Python, JavaScript, C++, and other popular languages? Where does Rust come from, and where is it going? How Rust manages change, and ensures backwards compatibility.

  • Idiomatic Rust: How do we write programs that can only be written in Rust? Using the type system to turn run-time errors into compile-time errors; the “newtype” and “typestate” patterns. Making invalid states unrepresentable. How Rust changes your brain (for the better).

First steps in Rust

  • Types: We’ll cover Rust’s type system and ask, why use types at all? How does the type system help ensure our programs are correct? The most common number types, such as i32 and usize. Representing text in Rust: the difference between String and &str, and when to use one or the other.

  • Structured data: Defining objects containing multiple data values, using the struct keyword, and using methods to associate behaviour with the data. Constructors, cleanup, printing and formatting, and assigning default values.

  • Collections and iterators: Handling larger amounts of data in Rust using arrays, vectors, sets, and hashmaps. Processing sequences of values using iterators, and applying functions over sequences.

  • Loops and conditionals: Repeated operations using the loop, while, and for keywords, and pattern matching for control flow using the if and match keywords.

  • Functions: How to define and call functions in Rust, arguments, return values, and what it means to say that “functions are values”. Using closures (functions that can be called multiple times while remembering their state in between calls).

  • Mutability: How Rust lets you manage shared read and write access to data in different parts of your program, using references and the mut keyword.

Safety and correctness

  • Ownership: Why every value in Rust has exactly one owner at a time, and how values can be moved or copied from one place to another. Understanding key traits such as Copy and Clone, and when to use them.

  • References and lifetimes: How the Rust compiler ensures that references to data are always valid, and when memory can be reclaimed after the data is finished with. const and static data, and annotating values with named lifetimes.

  • Safety: Understanding memory bugs and security vulnerabilities; how Rust’s safety guarantees help prevent them, and why the unsafe keyword is useful. Using checked arithmetic to avoid overflow errors.

Program structure

  • Code organisation: The structure of a Rust project, the Cargo.toml file, modules and namespaces, visibility, imports, dependencies, tests, and documentation.

  • Macros: Defining macros for boilerplate reduction or code generation. Useful standard library macros.

  • Error handling: Option and Result types and how they’re used in the standard library and in our own programs. Concise error handling with the ? operator.

  • Traits and generics: Describing data types in terms of their behaviour, and writing Rust code that performs the same operations on many different types at once. Smart pointers such as Box<T> and Arc<T>. Trait objects for dynamic typing using dyn Trait.

Ecosystem and tooling

  • Cargo and crates: Using the Cargo tool to build, test, format, and publish your Rust programs to the community hub at crates.io; adding, auditing, and updating dependencies; managing complexity using crates, modules, workspaces, and features.

  • The standard library: What you need to know about Rust’s built-in library types and features.

  • The wider ecosystem: The community’s favourite solutions for command-line interfaces (clap), error handling (anyhow), serialization (serde), database access (sqlx), Web clients (reqwest) and servers (axum).

Advanced topics

  • Concurrency: Parallel programming with threads, asynchronous programming using async / await, async executors (tokio) and futures, parallel iterators with rayon, message passing with streams and channels, and atomic operations.

  • Embedded development: Bare-metal programming for IoT devices, single-board computers, and microcontrollers. no_std development and the allocator API. Cross-compilation, debugger support, and deploying code with probe-rs.