#[repr(C)]pub struct Point<X, Y = X> {
pub x: X,
pub y: Y,
}Expand description
The Point implementation is designed a generic, 2-dimensional point object used to
define coordinates, vectors, or positions in a 2D space.
Fields§
§x: X§y: YImplementations§
Source§impl<X, Y> Point<X, Y>
impl<X, Y> Point<X, Y>
Sourcepub fn from_tuple(_: (X, Y)) -> Point<X, Y>
pub fn from_tuple(_: (X, Y)) -> Point<X, Y>
create a new instance from the given 2-tuple
Sourcepub fn with_x<X2>(self, x: X2) -> Point<X2, Y>
pub fn with_x<X2>(self, x: X2) -> Point<X2, Y>
consumes the current instance to create another with the given x value.
Sourcepub fn with_y<Y2>(self, y: Y2) -> Point<X, Y2>
pub fn with_y<Y2>(self, y: Y2) -> Point<X, Y2>
consumes the current instance to create another with the given y value.
Sourcepub const fn as_mut_view(&mut self) -> Point<&mut X, &mut Y>
pub const fn as_mut_view(&mut self) -> Point<&mut X, &mut Y>
returns a view of the Point containing mutable references to the inner values.
Sourcepub const fn as_tuple(&self) -> (&X, &Y)
pub const fn as_tuple(&self) -> (&X, &Y)
returns a 2-tuple containing references to the inner values.
Sourcepub fn into_tuple(self) -> (X, Y)
pub fn into_tuple(self) -> (X, Y)
consumes the caller to convert the object into a 2-tuple.
Trait Implementations§
Source§impl<X, Y> Ord for Point<X, Y>
impl<X, Y> Ord for Point<X, Y>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<X, Y> PartialOrd for Point<X, Y>where
X: PartialOrd,
Y: PartialOrd,
impl<X, Y> PartialOrd for Point<X, Y>where
X: PartialOrd,
Y: PartialOrd,
impl<X, Y> Copy for Point<X, Y>
impl<X, Y> Eq for Point<X, Y>
impl<X, Y> StructuralPartialEq for Point<X, Y>
Auto Trait Implementations§
impl<X, Y> Freeze for Point<X, Y>
impl<X, Y> RefUnwindSafe for Point<X, Y>where
X: RefUnwindSafe,
Y: RefUnwindSafe,
impl<X, Y> Send for Point<X, Y>
impl<X, Y> Sync for Point<X, Y>
impl<X, Y> Unpin for Point<X, Y>
impl<X, Y> UnwindSafe for Point<X, Y>where
X: UnwindSafe,
Y: UnwindSafe,
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