pub struct Coord<const X: u8, const Y: u8> { /* private fields */ }
Implementations§
Source§impl<const X: u8, const Y: u8> Coord<X, Y>
impl<const X: u8, const Y: u8> Coord<X, Y>
pub const fn from_index(index: u8) -> Self
pub const fn from_xy(x: u8, y: u8) -> Self
pub fn all() -> CoordAllIter<Self>
pub const fn index(self) -> u8
pub const fn dense_index(self, size: u8) -> usize
pub const fn x(self) -> u8
pub const fn y(self) -> u8
pub const fn manhattan_distance(self, other: Coord<X, Y>) -> u8
pub const fn diagonal_distance(self, other: Coord<X, Y>) -> u8
pub const fn cast<const X2: u8, const Y2: u8>(self) -> Coord<X2, Y2>
pub const fn valid_for_size(self, size: u8) -> bool
Trait Implementations§
Source§impl<const X: u8, const Y: u8> Ord for Coord<X, Y>
impl<const X: u8, const Y: u8> Ord for Coord<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<const X: u8, const Y: u8> PartialOrd for Coord<X, Y>
impl<const X: u8, const Y: u8> PartialOrd for Coord<X, Y>
impl<const X: u8, const Y: u8> Copy for Coord<X, Y>
impl<const X: u8, const Y: u8> Eq for Coord<X, Y>
impl<const X: u8, const Y: u8> StructuralPartialEq for Coord<X, Y>
Auto Trait Implementations§
impl<const X: u8, const Y: u8> Freeze for Coord<X, Y>
impl<const X: u8, const Y: u8> RefUnwindSafe for Coord<X, Y>
impl<const X: u8, const Y: u8> Send for Coord<X, Y>
impl<const X: u8, const Y: u8> Sync for Coord<X, Y>
impl<const X: u8, const Y: u8> Unpin for Coord<X, Y>
impl<const X: u8, const Y: u8> UnwindSafe for Coord<X, Y>
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§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