pub struct CoordPair<C> {
pub y: C,
pub x: C,
}
Fields§
§y: C
§x: C
Implementations§
Source§impl<C> CoordPair<C>
impl<C> CoordPair<C>
pub fn with_order(first: C, second: C) -> Self
pub fn from_axes<F>(generator: F) -> Self
pub fn try_from_axes<F, E>(generator: F) -> Result<Self, E>
pub fn into_order(self) -> (C, C)
pub fn as_ref(&self) -> CoordPair<&C>
pub fn as_mut(&mut self) -> CoordPair<&mut C>
pub fn map<F, C0>(self, mapper: F) -> CoordPair<C0>where
F: FnMut(C) -> C0,
pub fn try_map<F, C0, E>(self, mapper: F) -> Result<CoordPair<C0>, E>
pub fn map_with_axes<F, C0>(self, mapper: F) -> CoordPair<C0>
pub fn try_map_with_axes<F, C0, E>(self, mapper: F) -> Result<CoordPair<C0>, E>
pub fn shift(self) -> Self
pub fn shift_rev(self) -> Self
pub fn shift_in_place(&mut self)
pub fn shift_rev_in_place(&mut self)
pub fn shift_to(self, axis: Axis) -> Self
pub fn shift_in_place_to(&mut self, axis: Axis)
pub fn shift_rev_to(self, axis: Axis) -> Self
pub fn shift_rev_in_place_to(&mut self, axis: Axis)
pub fn zip2<C0>(self, other: CoordPair<C0>) -> CoordPair<(C, C0)>
pub fn zip2_with<F, C0, C1>(
self,
other: CoordPair<C0>,
zipper: F,
) -> CoordPair<C1>where
F: FnMut(C, C0) -> C1,
pub fn zip2_with_axes<F, C0, C1>( self, other: CoordPair<C0>, zipper: F, ) -> CoordPair<C1>
pub fn try_zip2_with<F, C0, C1, E>( self, other: CoordPair<C0>, zipper: F, ) -> Result<CoordPair<C1>, E>
pub fn try_zip2_with_axes<F, C0, C1, E>( self, other: CoordPair<C0>, zipper: F, ) -> Result<CoordPair<C1>, E>
pub fn zip3<C0, C1>( self, other: CoordPair<C0>, another: CoordPair<C1>, ) -> CoordPair<(C, C0, C1)>
pub fn zip3_with<F, C0, C1, C2>(
self,
other: CoordPair<C0>,
another: CoordPair<C1>,
zipper: F,
) -> CoordPair<C2>where
F: FnMut(C, C0, C1) -> C2,
pub fn zip3_with_axes<F, C0, C1, C2>( self, other: CoordPair<C0>, another: CoordPair<C1>, zipper: F, ) -> CoordPair<C2>
pub fn try_zip3_with<F, C0, C1, C2, E>( self, other: CoordPair<C0>, another: CoordPair<C1>, zipper: F, ) -> Result<CoordPair<C2>, E>
pub fn try_zip3_with_axes<F, C0, C1, C2, E>( self, other: CoordPair<C0>, another: CoordPair<C1>, zipper: F, ) -> Result<CoordPair<C2>, E>
pub fn extract(self, axis: Axis) -> C
pub fn all<F>(self, predicate: F) -> bool
pub fn any<F>(self, predicate: F) -> bool
pub fn checked_add_to(&self, other: &C) -> Option<Self>where
C: CheckedAdd,
pub fn checked_sub_except(&self, other: &C) -> Option<Self>where
C: CheckedSub,
pub fn checked_sub_from(&self, other: &C) -> Option<Self>where
C: CheckedSub,
pub fn checked_mul_scalar(&self, other: &C) -> Option<Self>where
C: CheckedMul,
pub fn checked_div_by(&self, other: &C) -> Option<Self>where
C: CheckedDiv,
pub fn checked_div_on(&self, other: &C) -> Option<Self>where
C: CheckedDiv,
pub fn checked_rem_by(&self, other: &C) -> Option<Self>where
C: CheckedRem,
pub fn checked_rem_on(&self, other: &C) -> Option<Self>where
C: CheckedRem,
pub fn saturating_add_to(&self, other: &C) -> Selfwhere
C: SaturatingAdd,
pub fn saturating_sub_except(&self, other: &C) -> Selfwhere
C: SaturatingSub,
pub fn saturating_sub_from(&self, other: &C) -> Selfwhere
C: SaturatingSub,
pub fn saturating_mul_scalar(&self, other: &C) -> Selfwhere
C: SaturatingMul,
pub fn div_floor_by(&self, divisor: &C) -> Selfwhere
C: Integer,
pub fn div_ceil_by(&self, divisor: &C) -> Selfwhere
C: Integer,
pub fn div_floor_on(&self, dividend: &C) -> Selfwhere
C: Integer,
pub fn div_ceil_on(&self, dividend: &C) -> Selfwhere
C: Integer,
pub fn div_floor(&self, other: &Self) -> Selfwhere
C: Integer,
pub fn div_ceil(&self, other: &Self) -> Selfwhere
C: Integer,
pub fn move_unit(self, direction: Direction) -> Self
pub fn checked_move_unit(&self, direction: Direction) -> Option<Self>
pub fn saturating_move_unit(&self, direction: Direction) -> Self
pub fn move_by(self, vector: DirectionVec<C>) -> Self
pub fn checked_move_by(&self, vector: DirectionVec<&C>) -> Option<Self>
pub fn saturating_move_by(&self, vector: DirectionVec<&C>) -> Self
pub fn as_rect_size(self, top_left: Self) -> Rect<C>
pub fn as_rect_top_left(self, size: Self) -> Rect<C>
pub fn direction_to(self, other: Self) -> Option<DirectionVec<C>>where
C: PartialOrd + Sub<Output = C>,
pub fn direction_from(self, other: Self) -> Option<DirectionVec<C>>where
C: PartialOrd + Sub<Output = C>,
Source§impl<'a, C> CoordPair<&'a C>
impl<'a, C> CoordPair<&'a C>
pub fn copied(self) -> CoordPair<C>where
C: Copy,
pub fn cloned(self) -> CoordPair<C>where
C: Clone,
pub fn checked_add_by_ref(self, other: Self) -> Option<CoordPair<C>>where
C: CheckedAdd,
pub fn checked_add_by_ref_to(self, other: &C) -> Option<CoordPair<C>>where
C: CheckedAdd,
pub fn checked_sub_by_ref(self, other: Self) -> Option<CoordPair<C>>where
C: CheckedSub,
pub fn checked_sub_by_ref_except(self, other: &C) -> Option<CoordPair<C>>where
C: CheckedSub,
pub fn checked_sub_by_ref_from(self, other: &C) -> Option<CoordPair<C>>where
C: CheckedSub,
pub fn checked_mul_by_ref(self, other: Self) -> Option<CoordPair<C>>where
C: CheckedMul,
pub fn checked_mul_by_ref_scalar(self, other: &C) -> Option<CoordPair<C>>where
C: CheckedMul,
pub fn checked_div_by_ref(self, other: Self) -> Option<CoordPair<C>>where
C: CheckedDiv,
pub fn checked_div_by_ref_by(self, other: &C) -> Option<CoordPair<C>>where
C: CheckedDiv,
pub fn checked_div_by_ref_on(self, other: &C) -> Option<CoordPair<C>>where
C: CheckedDiv,
pub fn checked_rem_by_ref(self, other: Self) -> Option<CoordPair<C>>where
C: CheckedRem,
pub fn checked_rem_by_ref_by(self, other: &C) -> Option<CoordPair<C>>where
C: CheckedRem,
pub fn checked_rem_by_ref_on(self, other: &C) -> Option<CoordPair<C>>where
C: CheckedRem,
pub fn saturating_add_by_ref(self, other: Self) -> CoordPair<C>where
C: SaturatingAdd,
pub fn saturating_add_by_ref_to(self, other: &C) -> CoordPair<C>where
C: SaturatingAdd,
pub fn saturating_sub_by_ref(self, other: Self) -> CoordPair<C>where
C: SaturatingSub,
pub fn saturating_sub_by_ref_except(self, other: &C) -> CoordPair<C>where
C: SaturatingSub,
pub fn saturating_sub_by_ref_from(self, other: &C) -> CoordPair<C>where
C: SaturatingSub,
pub fn saturating_mul_by_ref(self, other: Self) -> CoordPair<C>where
C: SaturatingMul,
pub fn saturating_mul_by_ref_scalar(self, other: &C) -> CoordPair<C>where
C: SaturatingMul,
pub fn div_floor_by_ref_by(self, divisor: &C) -> CoordPair<C>where
C: Integer,
pub fn div_ceil_by_ref_by(self, divisor: &C) -> CoordPair<C>where
C: Integer,
pub fn div_floor_by_ref_on(self, dividend: &C) -> CoordPair<C>where
C: Integer,
pub fn div_ceil_by_ref_on(self, dividend: &C) -> CoordPair<C>where
C: Integer,
pub fn div_floor_by_ref(self, other: Self) -> CoordPair<C>where
C: Integer,
pub fn div_ceil_by_ref(self, other: Self) -> CoordPair<C>where
C: Integer,
pub fn checked_move_unit_by_ref( self, direction: Direction, ) -> Option<CoordPair<C>>
pub fn saturating_move_unit_by_ref(self, direction: Direction) -> CoordPair<C>
pub fn checked_move_by_ref_by( self, vector: DirectionVec<&C>, ) -> Option<CoordPair<C>>
pub fn saturating_move_by_ref_by(self, vector: DirectionVec<&C>) -> CoordPair<C>
Trait Implementations§
Source§impl<C> AddAssign<C> for CoordPair<C>
impl<C> AddAssign<C> for CoordPair<C>
Source§fn add_assign(&mut self, rhs: C)
fn add_assign(&mut self, rhs: C)
Performs the
+=
operation. Read moreSource§impl<C> AddAssign for CoordPair<C>where
C: AddAssign,
impl<C> AddAssign for CoordPair<C>where
C: AddAssign,
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl<C> CheckedAdd for CoordPair<C>where
C: CheckedAdd,
impl<C> CheckedAdd for CoordPair<C>where
C: CheckedAdd,
Source§fn checked_add(&self, other: &Self) -> Option<Self>
fn checked_add(&self, other: &Self) -> Option<Self>
Adds two numbers, checking for overflow. If overflow happens,
None
is
returned.Source§impl<C> CheckedDiv for CoordPair<C>where
C: CheckedDiv,
impl<C> CheckedDiv for CoordPair<C>where
C: CheckedDiv,
Source§fn checked_div(&self, other: &Self) -> Option<Self>
fn checked_div(&self, other: &Self) -> Option<Self>
Divides two numbers, checking for underflow, overflow and division by
zero. If any of that happens,
None
is returned.Source§impl<C> CheckedMul for CoordPair<C>where
C: CheckedMul,
impl<C> CheckedMul for CoordPair<C>where
C: CheckedMul,
Source§fn checked_mul(&self, other: &Self) -> Option<Self>
fn checked_mul(&self, other: &Self) -> Option<Self>
Multiplies two numbers, checking for underflow or overflow. If underflow
or overflow happens,
None
is returned.Source§impl<C> CheckedRem for CoordPair<C>where
C: CheckedRem,
impl<C> CheckedRem for CoordPair<C>where
C: CheckedRem,
Source§fn checked_rem(&self, other: &Self) -> Option<Self>
fn checked_rem(&self, other: &Self) -> Option<Self>
Finds the remainder of dividing two numbers, checking for underflow, overflow and division
by zero. If any of that happens,
None
is returned. Read moreSource§impl<C> CheckedSub for CoordPair<C>where
C: CheckedSub,
impl<C> CheckedSub for CoordPair<C>where
C: CheckedSub,
Source§fn checked_sub(&self, other: &Self) -> Option<Self>
fn checked_sub(&self, other: &Self) -> Option<Self>
Subtracts two numbers, checking for underflow. If underflow happens,
None
is returned.Source§impl<'de, C> Deserialize<'de> for CoordPair<C>where
C: Deserialize<'de>,
impl<'de, C> Deserialize<'de> for CoordPair<C>where
C: Deserialize<'de>,
Source§fn 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
Source§impl<C> DivAssign<C> for CoordPair<C>
impl<C> DivAssign<C> for CoordPair<C>
Source§fn div_assign(&mut self, rhs: C)
fn div_assign(&mut self, rhs: C)
Performs the
/=
operation. Read moreSource§impl<C> DivAssign for CoordPair<C>where
C: DivAssign,
impl<C> DivAssign for CoordPair<C>where
C: DivAssign,
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/=
operation. Read moreSource§impl<C> MulAssign<C> for CoordPair<C>
impl<C> MulAssign<C> for CoordPair<C>
Source§fn mul_assign(&mut self, rhs: C)
fn mul_assign(&mut self, rhs: C)
Performs the
*=
operation. Read moreSource§impl<C> MulAssign for CoordPair<C>where
C: MulAssign,
impl<C> MulAssign for CoordPair<C>where
C: MulAssign,
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moreSource§impl<C: Ord> Ord for CoordPair<C>
impl<C: Ord> Ord for CoordPair<C>
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<C: PartialOrd> PartialOrd for CoordPair<C>
impl<C: PartialOrd> PartialOrd for CoordPair<C>
Source§impl<C> RemAssign<C> for CoordPair<C>
impl<C> RemAssign<C> for CoordPair<C>
Source§fn rem_assign(&mut self, rhs: C)
fn rem_assign(&mut self, rhs: C)
Performs the
%=
operation. Read moreSource§impl<C> RemAssign for CoordPair<C>where
C: RemAssign,
impl<C> RemAssign for CoordPair<C>where
C: RemAssign,
Source§fn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
Performs the
%=
operation. Read moreSource§impl<C> SaturatingAdd for CoordPair<C>where
C: SaturatingAdd,
impl<C> SaturatingAdd for CoordPair<C>where
C: SaturatingAdd,
Source§fn saturating_add(&self, other: &Self) -> Self
fn saturating_add(&self, other: &Self) -> Self
Saturating addition. Computes
self + other
, saturating at the relevant high or low boundary of
the type.Source§impl<C> SaturatingMul for CoordPair<C>where
C: SaturatingMul,
impl<C> SaturatingMul for CoordPair<C>where
C: SaturatingMul,
Source§fn saturating_mul(&self, other: &Self) -> Self
fn saturating_mul(&self, other: &Self) -> Self
Saturating multiplication. Computes
self * other
, saturating at the relevant high or low boundary of
the type.Source§impl<C> SaturatingSub for CoordPair<C>where
C: SaturatingSub,
impl<C> SaturatingSub for CoordPair<C>where
C: SaturatingSub,
Source§fn saturating_sub(&self, other: &Self) -> Self
fn saturating_sub(&self, other: &Self) -> Self
Saturating subtraction. Computes
self - other
, saturating at the relevant high or low boundary of
the type.Source§impl<C> SubAssign<C> for CoordPair<C>
impl<C> SubAssign<C> for CoordPair<C>
Source§fn sub_assign(&mut self, rhs: C)
fn sub_assign(&mut self, rhs: C)
Performs the
-=
operation. Read moreSource§impl<C> SubAssign for CoordPair<C>where
C: SubAssign,
impl<C> SubAssign for CoordPair<C>where
C: SubAssign,
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl<C: Copy> Copy for CoordPair<C>
impl<C: Eq> Eq for CoordPair<C>
impl<C> StructuralPartialEq for CoordPair<C>
Auto Trait Implementations§
impl<C> Freeze for CoordPair<C>where
C: Freeze,
impl<C> RefUnwindSafe for CoordPair<C>where
C: RefUnwindSafe,
impl<C> Send for CoordPair<C>where
C: Send,
impl<C> Sync for CoordPair<C>where
C: Sync,
impl<C> Unpin for CoordPair<C>where
C: Unpin,
impl<C> UnwindSafe for CoordPair<C>where
C: 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