Implementing structs
Course: Rust Bootcamp - chapter 16
You can also implement structs , which means you can attach functions to instances of structs
(Very similar to classes in TS)
struct Rect { width: u32, height: u32,}
impl Rect { fn area(&self) -> u32 { self.width * self.height }}
fn main() { let rect = Rect { width: 30, height: 50, }; print!("The area of the rectangle is {}", rect.area());}