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