]> git.proxmox.com Git - rustc.git/blob - src/doc/book/src/ch05-00-structs.md
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / doc / book / src / ch05-00-structs.md
1 # Using Structs to Structure Related Data
2
3 A *struct*, or *structure*, is a custom data type that lets you name and
4 package together multiple related values that make up a meaningful group. If
5 you’re familiar with an object-oriented language, a *struct* is like an
6 object’s data attributes. In this chapter, we’ll compare and contrast tuples
7 with structs, demonstrate how to use structs, and discuss how to define methods
8 and associated functions to specify behavior associated with a struct’s data.
9 Structs and enums (discussed in Chapter 6) are the building blocks for creating
10 new types in your program’s domain to take full advantage of Rust’s compile
11 time type checking.