Rust theorytheory 0/50 · 0%
Types · easy

11. Structs

Named product types.

Structs group named fields. Tuple structs give positional fields, and unit structs carry no data. `impl` blocks add methods taking `&self`, `&mut self` or `self`, plus associated functions like `new` that have no receiver.

Check your understanding

  1. 1. What does an associated function lack?

  2. 2. Which receiver allows mutating fields?