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.

  • Beginner
  • Intermediate
  • Advanced
lessons
10
modules
4
tests
10
hours of lessons
3.1

Course content

4 modules, 10 lessons. Each module has its own level, and the lessons follow in order.

  1. Rust basics

    Beginner3 lessons · 45 min

    Install Rust, run your first program with Cargo and get to know variables, types, functions, conditions and loops.

    1. 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
    2. 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
    3. 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
  2. Ownership, custom types and errors

    Intermediate3 lessons · 60 min

    Master the ownership and borrowing rules, build structs and enums, and handle errors with `Result` and `?`.

    1. 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
    2. 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
    3. 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
  3. Collections and generic code

    Intermediate2 lessons · 38 min

    Work with `Vec`, `HashMap`, closures and iterators, and write reusable code with traits, generics and lifetimes.

    1. 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
    2. 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
  4. Advanced Rust and a real project

    Advanced2 lessons · 44 min

    Use smart pointers, threads, channels and `Arc<Mutex<T>>`, then build a complete CLI tool with modules, crates.io and tests.

    1. 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
    2. 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