Structs 101

For this chapter, I am going to ask you to imagine the following scenario. I have a house. My house has a certain number of rooms and each room has a name. Each room has one or more doors and windows and a carpet (with a color), and the rooms have a width and length. We will use structs and enums to model all this.

Structs in Rust are very common; they are used in many facets of the language and are useful to understand and use. In terms of the house example, we'll see how useful they can be.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset