1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
pub struct Player { x: f64, y: f64, } impl Player { pub fn new(x: f64, y: f64) -> Self { Self { x, y } } pub fn x(&self) -> f64 { self.x } pub fn y(&self) -> f64 { self.y } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
pub struct Player { x: f64, y: f64, } impl Player { pub fn new(x: f64, y: f64) -> Self { Self { x, y } } pub fn x(&self) -> f64 { self.x } pub fn y(&self) -> f64 { self.y } }