Expand description
A 2D coordinate, also known as a point
A coordinate (or point) is an absolute position. One cannot add a point to
a point. The difference between two points is an Offset.
Tuple Fields
0: i321: i32Implementations
sourceimpl Coord
impl Coord
sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Restrict a value to the specified interval, componentwise
sourcepub fn distance_l1(self) -> i32
pub fn distance_l1(self) -> i32
Return the L1 (rectilinear / taxicab) distance
sourcepub fn distance_l_inf(self) -> i32
pub fn distance_l_inf(self) -> i32
Return the L-inf (max) distance
sourcepub fn extract<D: Directional>(self, dir: D) -> i32
pub fn extract<D: Directional>(self, dir: D) -> i32
Extract one component, based on a direction
This merely extracts the horizontal or vertical component. It never negates it, even if the axis is reversed.
sourcepub fn set_component<D: Directional>(&mut self, dir: D, value: i32)
pub fn set_component<D: Directional>(&mut self, dir: D, value: i32)
Set one component of self, based on a direction
This does not negate components when the direction is reversed.
Trait Implementations
sourceimpl AddAssign<Offset> for Coord
impl AddAssign<Offset> for Coord
sourcefn add_assign(&mut self, rhs: Offset)
fn add_assign(&mut self, rhs: Offset)
Performs the += operation. Read more
sourceimpl AddAssign<Size> for Coord
impl AddAssign<Size> for Coord
sourcefn add_assign(&mut self, rhs: Size)
fn add_assign(&mut self, rhs: Size)
Performs the += operation. Read more
sourceimpl ConvApprox<DVec2> for Coord
impl ConvApprox<DVec2> for Coord
sourcefn try_conv_approx(arg: DVec2) -> Result<Self>
fn try_conv_approx(arg: DVec2) -> Result<Self>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: T) -> Self
fn conv_approx(x: T) -> Self
Converting from T to Self, allowing approximation of value Read more
sourceimpl<X: CastApprox<i32>> ConvApprox<PhysicalPosition<X>> for Coord
Available on crate feature winit only.
impl<X: CastApprox<i32>> ConvApprox<PhysicalPosition<X>> for Coord
winit only.sourcefn try_conv_approx(pos: PhysicalPosition<X>) -> Result<Self>
fn try_conv_approx(pos: PhysicalPosition<X>) -> Result<Self>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: T) -> Self
fn conv_approx(x: T) -> Self
Converting from T to Self, allowing approximation of value Read more
sourceimpl ConvApprox<Vec2> for Coord
impl ConvApprox<Vec2> for Coord
sourcefn try_conv_approx(arg: Vec2) -> Result<Self>
fn try_conv_approx(arg: Vec2) -> Result<Self>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: T) -> Self
fn conv_approx(x: T) -> Self
Converting from T to Self, allowing approximation of value Read more
sourceimpl ConvFloat<DVec2> for Coord
impl ConvFloat<DVec2> for Coord
sourcefn try_conv_trunc(x: DVec2) -> Result<Self>
fn try_conv_trunc(x: DVec2) -> Result<Self>
Try converting to integer with truncation Read more
sourcefn try_conv_nearest(x: DVec2) -> Result<Self>
fn try_conv_nearest(x: DVec2) -> Result<Self>
Try converting to the nearest integer Read more
sourcefn try_conv_floor(x: DVec2) -> Result<Self>
fn try_conv_floor(x: DVec2) -> Result<Self>
Try converting the floor to an integer Read more
sourcefn try_conv_ceil(x: DVec2) -> Result<Self>
fn try_conv_ceil(x: DVec2) -> Result<Self>
Try convert the ceiling to an integer Read more
sourcefn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Convert to integer with truncatation Read more
sourcefn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Convert to the nearest integer Read more
sourcefn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Convert the floor to an integer Read more
sourceimpl ConvFloat<Vec2> for Coord
impl ConvFloat<Vec2> for Coord
sourcefn try_conv_trunc(x: Vec2) -> Result<Self>
fn try_conv_trunc(x: Vec2) -> Result<Self>
Try converting to integer with truncation Read more
sourcefn try_conv_nearest(x: Vec2) -> Result<Self>
fn try_conv_nearest(x: Vec2) -> Result<Self>
Try converting to the nearest integer Read more
sourcefn try_conv_floor(x: Vec2) -> Result<Self>
fn try_conv_floor(x: Vec2) -> Result<Self>
Try converting the floor to an integer Read more
sourcefn try_conv_ceil(x: Vec2) -> Result<Self>
fn try_conv_ceil(x: Vec2) -> Result<Self>
Try convert the ceiling to an integer Read more
sourcefn conv_trunc(x: T) -> Self
fn conv_trunc(x: T) -> Self
Convert to integer with truncatation Read more
sourcefn conv_nearest(x: T) -> Self
fn conv_nearest(x: T) -> Self
Convert to the nearest integer Read more
sourcefn conv_floor(x: T) -> Self
fn conv_floor(x: T) -> Self
Convert the floor to an integer Read more
sourceimpl<'de> Deserialize<'de> for Coord
impl<'de> Deserialize<'de> for Coord
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl PartialEq<Coord> for Coord
impl PartialEq<Coord> for Coord
sourceimpl SubAssign<Offset> for Coord
impl SubAssign<Offset> for Coord
sourcefn sub_assign(&mut self, rhs: Offset)
fn sub_assign(&mut self, rhs: Offset)
Performs the -= operation. Read more
sourceimpl SubAssign<Size> for Coord
impl SubAssign<Size> for Coord
sourcefn sub_assign(&mut self, rhs: Size)
fn sub_assign(&mut self, rhs: Size)
Performs the -= operation. Read more
impl Copy for Coord
impl Eq for Coord
impl StructuralEq for Coord
impl StructuralPartialEq for Coord
Auto Trait Implementations
impl RefUnwindSafe for Coord
impl Send for Coord
impl Sync for Coord
impl Unpin for Coord
impl UnwindSafe for Coord
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
sourcefn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
Try approximate conversion from Self to T Read more
sourcefn cast_approx(self) -> T
fn cast_approx(self) -> T
Cast approximately from Self to T Read more
sourceimpl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
sourcefn cast_trunc(self) -> T
fn cast_trunc(self) -> T
Cast to integer, truncating Read more
sourcefn cast_nearest(self) -> T
fn cast_nearest(self) -> T
Cast to the nearest integer Read more
sourcefn cast_floor(self) -> T
fn cast_floor(self) -> T
Cast the floor to an integer Read more
sourcefn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
sourcefn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
sourcefn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
sourcefn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more
sourceimpl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
impl<S, T> ConvApprox<S> for Twhere
T: Conv<S>,
sourcefn try_conv_approx(x: S) -> Result<T, Error>
fn try_conv_approx(x: S) -> Result<T, Error>
Try converting from T to Self, allowing approximation of value Read more
sourcefn conv_approx(x: S) -> T
fn conv_approx(x: S) -> T
Converting from T to Self, allowing approximation of value Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.