Skip to main content

Chapter 2: Ownership, Structs, and Error Handling in Rust

Memory safety and expressive domain modeling are Rust's signature pairing. This chapter moves beyond syntax into how values live on the stack and heap, how you shape data with structs and enums, and how Option, Result, and pattern matching keep failures explicit instead of silent.

Work through the series in order: custom types and modules set the stage before ownership rules explain why the compiler insists on moves, borrows, and lifetimes you will deepen later.

Series in this Chapter