struct Boat { make : String, length : u32, horsepower : u32, } impl Boat { fn print(&self) { println!("Make: {}\nModel: {}\nHorsepower: {}\n", self.make, self.length, self.horsepower); } } use std::collections::HashMap; fn make_boat_in_box(){ let mut b = Box::new(Boat {make: "Bayliner".to_string(), length: 17, horsepower: 120}); b.print(); b.length = 25; b.print(); } fn main(){ make_boat_in_box(); // let mut trees : HashMap<&str, Boat> = HashMap::new(); let mut trees = HashMap::new(); trees.insert("Fiberform", Boat {make: "Fiberform".to_string(), length: 18, horsepower: 160}); trees.insert("Giant", Boat {make: "American".to_string(), length: 21, horsepower: 260}); for (key, value) in trees { println!("{}:", key); value.print(); } let x; x = 347; println!("x = {}", x); }