pub struct Position { /* private fields */ }Expand description
2D position.
Implementations§
Source§impl Position
impl Position
pub const fn new(x: f64, y: f64) -> Self
pub const fn x(&self) -> f64
pub const fn y(&self) -> f64
Sourcepub fn distance_to(&self, other: &Self) -> f64
pub fn distance_to(&self, other: &Self) -> f64
Calculates the Euclidean distance to another position.
This method is not const because it uses f64::hypot() which performs
floating-point operations (including sqrt) that are not available in const contexts.
Trait Implementations§
impl Copy for Position
impl StructuralPartialEq for Position
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnwindSafe for Position
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more