Structs

Get introduced to structs, the foundation of custom Rust data types.

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.

  1. Regular structs:
struct Person {
    name: String,
    age: i8,
}
...