---
title: "Chapter 10: Structs and Methods"
description: "The 10 lessons of chapter 10: Structs and Methods, in teaching order."
url: "https://learnrust.net/chapter-10/"
last_updated: "2026-06-13"
---

# Chapter 10: Structs and Methods

- [10.1 Introduction to program-defined types](https://learnrust.net/chapter-10/introduction-to-program-defined-types.md): Why every language lets you define your own types, how a struct groups related data under one name, and Rust's naming conventions for types.
- [10.2 Defining and instantiating structs](https://learnrust.net/chapter-10/defining-and-instantiating-structs.md): How to define a struct's fields, create an instance, read and write fields with dot notation, and why Rust makes the whole struct mutable, not individual fields.
- [10.3 Field init shorthand and update syntax](https://learnrust.net/chapter-10/field-init-and-update-syntax.md): Field init shorthand removes repetition when a variable already shares a field's name, and struct update syntax builds a new instance from an existing one.
- [10.4 Tuple structs and unit structs](https://learnrust.net/chapter-10/tuple-structs-and-unit-structs.md): Tuple structs give a tuple a name and its own type, the newtype pattern wraps a value to make it distinct, and unit structs carry no data at all.
- [10.5 Methods and impl blocks](https://learnrust.net/chapter-10/methods-and-impl-blocks.md): How impl blocks attach methods to a struct, the difference between &self, &mut self, and self, and why method receivers are just chapters 8 and 9 in new clothing.
- [10.6 Associated functions and constructors](https://learnrust.net/chapter-10/associated-functions-and-constructors.md): Associated functions belong to a type without taking self; ::new is a convention not a keyword, and Default supplies sensible starting values.
- [10.7 Deriving Debug and printing structs](https://learnrust.net/chapter-10/deriving-debug.md): Why a struct can't be printed with {} by default, how #[derive(Debug)] enables {:?} and {:#?}, and what derive means as boilerplate the compiler writes.
- [10.8 Ownership in structs](https://learnrust.net/chapter-10/ownership-in-structs.md): Structs own their fields, so moving a struct moves everything inside it; storing a reference in a struct requires a lifetime, which Rust defers to chapter 17.
- [10.9 Project: rectangles](https://learnrust.net/chapter-10/project-rectangles.md): A program built one compiling step at a time: from loose variables to a tuple to a struct with methods, watching each refactor make the code clearer.
- [10.x Chapter 10 summary and quiz](https://learnrust.net/chapter-10/chapter-10-summary-and-quiz.md): Review of structs, methods, associated functions, deriving Debug, and ownership in structs, with a chapter quiz and a capstone program.

## Sitemap

See the full [sitemap](https://learnrust.net/sitemap.md) for all pages.
