Pebellslearn by building
RoadmapsMatrixCoursesSandboxSign in

Course details

Rust

Learn Rust from the ground up: its syntax and types, the ownership and borrowing rules that make it safe, error handling with Option and Result, modules and crates, and testing. Every lesson builds on one small lending-library program.

Ready to learn6 sections · 24 lessons
Start learning

Course curriculum

Introduction to Rust5 lessons

Meet Rust and the problem it solves, then learn the everyday building blocks: variables and constants, control flow, functions and methods, and pattern matching. Every example belongs to one small lending-library program.

  1. What Rust Is and Why People Choose It12 min
  2. Variables, Data Types and Constants12 min
  3. Control Flow: if, loop, while and for12 min
  4. Functions and Method Syntax12 min
  5. Pattern Matching and Destructuring15 min
Language Basics5 lessons

Install Rust with rustup, create and run a project with Cargo, and choose an editor or the online Playground. Then learn the scalar types, text, tuples and arrays, and the growable collections every Rust program leans on.

  1. Installing Rust and Cargo12 min
  2. Editors, Toolchains and the Rust Playground12 min
  3. Integers, Floats, Booleans and Characters12 min
  4. Strings, Tuples and Arrays12 min
  5. Vectors, HashMaps and HashSets15 min
Ownership and Borrowing3 lessons

See where values live in memory, learn the three ownership rules that decide when each value is freed, and borrow values through references and slices without taking them over. This is the idea the rest of Rust is built on.

  1. Stack vs Heap12 min
  2. The Ownership Rules15 min
  3. Borrowing, References and Slices15 min
Types and Error Handling5 lessons

Build the library's own types with structs, impl blocks and enums, then handle missing values and failures with Option and Result, pass errors upward with the ? operator, and define your own error type with traits.

  1. Structs and Impl Blocks12 min
  2. Enums: One of Several Shapes12 min
  3. Option and Result15 min
  4. Propagating Errors with ?12 min
  5. Traits and Custom Error Types18 min
Modules and Crates3 lessons

Split the library program into modules with clear public and private parts, add third-party crates with Cargo and understand version ranges and the lock file, then prepare and publish a crate on crates.io.

  1. Modules, Paths and Privacy15 min
  2. Dependencies with Cargo12 min
  3. Publishing on crates.io12 min
Testing3 lessons

Write unit tests beside the code with #[test] and assert macros, test the public API from the tests folder, replace slow or unpredictable parts with test doubles, and let property-based tests hunt for the inputs you did not think of.

  1. Unit Tests with #[test]15 min
  2. Integration Tests in the tests Folder12 min
  3. Mocking and Property-Based Testing18 min