Structs
Get introduced to structs, the foundation of custom Rust data types.
We'll cover the following...
We'll cover the following...
Structs are the foundation of dealing with data in Rust. Let’s do a quick review of the basics before we dive in deeper.
A quick review of structs
A structure is a named collection, defining a new type. A struct can take one of three forms.
- Regular structs:
struct Person {
name: String,
age: i8,
}
- Tuple structs:
struct Point(i32, i32, i32);
...