Struct methods
You can declare methods on your types:
#![allow(unused)] fn main() { struct Point { x: f64, // 64-bit floating point, aka "double precision" y: f64, } impl Number { fn is_origin(&self) -> bool { self.x == 0.0 && self.y == 0.0 } } }
You can declare methods on your types:
#![allow(unused)] fn main() { struct Point { x: f64, // 64-bit floating point, aka "double precision" y: f64, } impl Number { fn is_origin(&self) -> bool { self.x == 0.0 && self.y == 0.0 } } }