pub struct Point { /* private fields */ }
Expand description
A Point
is specified by a x coordinate and an y coordinate.
§Examples
let point = Point::new(10., 10.);
let other_point = Point::new(5., 7.);
let result = point - other_point;
assert_eq!(result.x(), 5.);
assert_eq!(result.y(), 3.);
Implementations§
Source§impl Point
impl Point
Sourcepub fn distance(&self, other: Point) -> f64
pub fn distance(&self, other: Point) -> f64
Returns the distance between this Point
and the given Point
.
pub fn min(self, other: impl Into<Point>) -> Point
pub fn max(self, other: impl Into<Point>) -> Point
pub fn sqrt(self) -> Point
pub fn abs(self) -> Point
pub fn clamp(self, min: f64, max: f64) -> Point
Trait Implementations§
impl Copy for Point
impl StructuralPartialEq for Point
Auto Trait Implementations§
impl Freeze for Point
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more