Rust Notes — Module 3
Rust Notes — Module 3: Structs & Enums 1. Structs Structs group related data together into a named type — same concept as C structs, cleaner syntax. struct User { username: String, email: String, age: u32, active: bool, } Creating and Accessing let user = User { username: String::from("sanketh"), email: String::from("sanketh@example.com"), age: 20, active: true, }; println!("{}", user.username); // field access with . Mutability The entire instance must be mut — you cannot mark individual fields as mutable: ...