Guide contents

Lesson 1 of 94

Introduction: How This Course Works

This course teaches Rust, from "Hello, world" to unsafe, macros, and async internals. Each lesson teaches through numbered, runnable examples.

Who this course is for

  • You already program in another language and want to learn Rust.
  • You are new to Rust, or you tried it and bounced off the borrow checker.

You do not need any C or C++ background. Where Rust uses a systems-programming idea (the stack, the heap, pointers), the lesson explains it from first principles.

How to read the code blocks

Each code block is labeled with its language and has a colored edge.

A Rust block has an orange edge. This is the code you are learning:

Rust
fn main() {
    println!("Hello from Rust");
}

An Output block sits directly under a Rust example and shows exactly what it prints:

Output
Hello from Rust

A Rust block with a red edge and a โœ— does not compile badge is a deliberate mistake. It shows what the compiler rejects and why. The badge includes the compiler's error code (such as E0384), which you can look up with rustc --explain E0384:

Rustโœ— does not compile ยท E0384
fn main() {
    let count = 1;
    count = 2; // not allowed: `count` is immutable
    println!("{count}");
}

A Terminal block shows commands you type in a shell:

Terminal
cargo run

How to run the examples

Every Rust example is a complete program with a main function. You can run any of them in two ways:

  • Paste it into the Rust Playground in your browser. There is nothing to install.
  • Paste it into src/main.rs of a Cargo project and run cargo run. The Installing Rust & Cargo lesson shows how to set that up.

Some lessons use libraries from crates.io, such as anyhow, clap, serde, tokio, axum, and sqlx. Those lessons show the exact cargo add commands or Cargo.toml lines you need.

Versions

  • Edition: Rust 2024. The edition is Rust's opt-in language version, covered in What Is Rust? and Installing Rust & Cargo.
  • Compiler: every example is checked with a recent stable rustc. Nothing in this course needs a nightly compiler.
  • Async runtime: Tokio, the de facto standard.

Two areas of Rust were still changing in 2026. Lessons that touch them are marked with ๐Ÿšง so you know to check the current state:

  • ๐Ÿšง async fn in traits works with generics (static dispatch), but not directly with dyn Trait. See Async Traits.
  • ๐Ÿšง The async Stream trait is not in the standard library yet. It lives in the futures and tokio-stream crates. See Async Streams.

The roadmap

The course has 19 sections. Each section builds only on the ones before it.

# Section What you will be able to do afterwards
1 Getting Started Understand what Rust is and where it fits, install it, use Cargo, print formatted output
2 Language Basics Write functions with variables, numbers, loops, tuples, arrays, and a first String, Vec, and HashMap
3 Ownership & Borrowing Understand moves, copies, clones, references, slices, and strings, and apply them to collections: the core of Rust
4 Structs, Enums & Pattern Matching Model data with structs and enums, use Option for missing values and Result for errors
5 Lifetimes Read and write lifetime annotations, and fix any borrow checker error
6 Traits & Generics Write Rust's interfaces and generic code, with static and dynamic dispatch
7 Closures & Iterators Use Rust's closures and iterators
8 Collections Use Vec, HashMap, HashSet, BTreeMap, VecDeque, and BinaryHeap in depth
9 Modules, Crates & Testing Split a project into modules and crates, and test it
10 Error Handling Design error types for real applications and libraries
11 Files, I/O & the Command Line Read and write files, walk directories, use stdin and stdout, parse arguments with clap, run other programs
12 Smart Pointers Choose between Box, Rc, Weak, RefCell, and Cow
13 OOP & Design Patterns Apply object-oriented design and the Gang of Four patterns in idiomatic Rust
14 Concurrency Write threaded code the compiler proves free of data races
15 Async Rust Build concurrent I/O with Tokio, async traits, and streams, and know how futures, Pin, and wakers work
16 Memory Management Reason about allocation, freeing, leaks, allocators, the memory model, and undefined behavior
17 Advanced Rust Advanced lifetimes, declarative and procedural macros, unsafe, no_std, performance, and API design
18 Under the Hood Know what the compiler does with your code and how the runtime and Tokio's scheduler run it
19 Production Rust Handle panics, avoid async pitfalls, test with properties, fuzzing, and benchmarks, keep builds fast, secure the supply chain and CI, debug and observe services in production, and structure larger services and teams

After the course, two follow-up courses put the language to work: Essential Crates covers serde, dates and regexes, tracing, axum, reqwest, and sqlx, and Practical Examples builds twelve complete programs, from a log analyzer and a calculator to a REST API, a web crawler, and a key-value server.

Other resources

Official documentation to keep open while you learn:

Next: What Is Rust?, an overview of the language for experienced developers.