Course

Rust from the ground up

Fast code the compiler checks

  • Beginner
  • 12 chapters
  • 194 min read

A hands-on introduction to Rust, from your first program to threads and shared state: ownership and borrowing explained in plain words, every idea run on a real compiler, and a short quiz at the end of each chapter.

What You'll Learn

  • Write and run a Rust program, and read what the compiler tells you
  • Use the everyday types, and say when a value may change
  • Write functions, decisions and loops that return values
  • Understand ownership: one owner, moves, and clones you chose
  • Borrow with references and slices instead of giving values away
  • Model data with structs, methods and enums — including Option
  • Match on values and handle every case the compiler asks for
  • Return results, use the question mark, and know when a panic is right
  • Keep data in vectors and maps, and say it with iterator chains
  • Describe behaviour with traits and reuse it through generics
  • Split a program into modules and write tests beside the code
  • Run work on threads, and share state safely with Arc and Mutex

Prerequisites

  • No Rust at all — the course starts at the first program
  • Any experience with one other language makes the first chapters quicker, but none is assumed

Course Content

  1. 01
    Your first Rust program

    What Rust is, what the compiler does for you, and the smallest complete program — one function, one line of output, and a run.

    Beginner · 12 min read

    Not started
  2. 02
    Values, types and printing

    Variables that cannot be reassigned by accident, the handful of types you will actually use, and how to put values into text without guessing.

    Beginner · 14 min read

    Not started
  3. 03
    Functions, decisions and loops

    Functions that take values and give one back, if and match as expressions, and the three loops Rust gives you — including the one that returns a value.

    Beginner · 15 min read

    Not started
  4. 04
    Ownership

    The rule that everything else in Rust rests on: every value has one owner, moving it is not copying it, and the value is cleaned up when the owner goes out of scope.

    Intermediate · 18 min read

    Not started
  5. 05
    Borrowing and references

    Lending a value instead of giving it away: &T to read, &mut T to change, the one rule that keeps them safe, and slices — a view into part of a collection.

    Intermediate · 17 min read

    Not started
  6. 06
    Structs, methods and enums

    Making your own types: a struct gathers fields, impl gathers the behaviour that goes with them, and an enum says a value is one of a fixed set of shapes.

    Intermediate · 16 min read

    Not started
  7. 07
    Pattern matching

    match that checks every case, patterns that pull data apart while choosing, and the shorter if let and while let for when one case is all you care about.

    Intermediate · 15 min read

    Not started
  8. 08
    Errors you can recover from

    Result instead of exceptions, unwrap and expect and when to avoid them, the question mark that passes errors up a level, and the line between a bug and a bad day.

    Intermediate · 18 min read

    Not started
  9. 09
    Vectors, maps and iterators

    The two collections you will reach for first — a growable list and a lookup by key — and the iterator chain that turns a loop into a sentence.

    Intermediate · 18 min read

    Not started
  10. 10
    Traits and generics

    Describing behaviour instead of types — a trait is a promise a type can keep — and writing one function that works for every type that keeps it.

    Advanced · 17 min read

    Not started
  11. 11
    Modules, crates and tests

    Splitting a program into files that can see only what they should, the cargo commands that hold a project together, and the tests that live beside the code they check.

    Advanced · 16 min read

    Not started
  12. 12
    Threads and shared state

    Running work at the same time, sending values between threads, and sharing one value safely with Arc and Mutex — the chapter where the ownership rules pay off.

    Advanced · 18 min read

    Not started