Structs

Types are PascalCase. Structs can be named tuples:

#![allow(unused)] fn main() { #[derive(Debug)] struct Rgb(u8, u8, u8); let colour = Rgb(5,5,5); println!("{:?}", colour); }

or with named fields

#[derive(Debug)] struct Person { name: String, age: u8, } fn main() { let age = 38; let me = Person { name: "Liam".to_string(), age }; println!("{:?}", me); }

Struct update

#![allow(unused)] fn main() { let user2 = User { email: String::from("another@example.com"), ..user1 }; }