// for compile error #[derive(Debug)] struct Rectangle { width: u32, height: u32, sqr_rec: () => {} } fn main() { let rect1 = Rectangle { width: 30, height: 50, }; // ? tells compiler to output to console println!("rect1 is {:#?}", rect1); println!( "The area of the rectangle is {} square pixels.", area(&rect1) ); } fn area(rectangle: &Rectangle) -> u32 { rectangle.width * rectangle.height } // 'Class' Method and Constructor (associated method (doesn't have self as fitst arg)) // Self = Struct Name ( Rectangle in this case) impl Rectangle { fn new() -> Self { Self { width: 100, height: 100, fn sqr_rec(&self) fn sqr_rec(mut &self) } } } let rec1 = Rectangle::new(); let width = rec1.width; let height = rect.height;