Chapter 6
Structs & Enums
A struct, or structure, is a custom data type that lets you package together and name multiple related values.
struct User {
username: String,
active: bool,
}
enum Message {
Quit,
Move { x: i32, y: i32 },
}
Chapter 6
A struct, or structure, is a custom data type that lets you package together and name multiple related values.
struct User {
username: String,
active: bool,
}
enum Message {
Quit,
Move { x: i32, y: i32 },
}