RsRust

Learn Rust – all lessons

16 lessons from beginner to advanced, building on each other and with code examples.

Beginner
1

Hello World, println! & Cargo

Your first Rust program, output macros, and the Cargo workflow.

2

Variables, Mutability & Types

let, mut, shadowing, and the most important data types.

3

Conditions & Loops

if as an expression, loop, while, for, and ranges.

4

Functions & Expressions

Parameters, return values, and the important difference between an expression and a statement.

5

Ownership: Owning & Moving

The central idea of Rust: every value has exactly one owner.

6

References & Borrowing

Borrowing values with & and &mut, and the rules of the borrow checker.

7

Structs & Methods

Custom data types with impl blocks, derive, and constructor functions.

Intermediate
8

Enums, match & Option

Enums with data, exhaustive pattern matching, and handling “no value”.

9

Error Handling with Result & ?

Recoverable errors, the ? operator, and custom error types.

10

Vec, String & HashMap

The most important collections of the standard library and how Rust handles text.

11

Traits & Generics

Describing shared behavior and writing code for many types.

12

Iterators & Closures

Functional data processing with no runtime overhead.

13

Cargo, Modules & Tests

Structuring projects, managing dependencies, and testing code.

Advanced
14

Lifetimes

Why references need lifetime annotations and how to read them.

15

Smart Pointers: Box, Rc, RefCell

Heap memory, shared ownership, interior mutability, and trait objects.

16

Concurrency: Threads, Channels, Mutex

Fearless concurrency: Rust prevents data races at compile time.