rustbook_learning_guide/data_structures.rs
1//! Data structure examples
2
3pub fn struct_examples() {
4 println!("\n🏗️ Struct Examples");
5 println!("{}", "-".repeat(19));
6
7 #[derive(Debug)]
8 struct Person {
9 name: String,
10 age: u32,
11 }
12
13 let person = Person {
14 name: "Alice".to_string(),
15 age: 30,
16 };
17
18 println!("Person: {:?}", person);
19}
20
21
22
23
24