Struct hex_coordinates::OffsetCoordinates
source · [−]pub struct OffsetCoordinates<const S: OffsetSystem> {
pub col: isize,
pub row: isize,
}Expand description
See OffsetSystem.
Fields
col: isizerow: isizeImplementations
sourceimpl<const S: OffsetSystem> OffsetCoordinates<S>
impl<const S: OffsetSystem> OffsetCoordinates<S>
sourceimpl OffsetCoordinates<{ OffsetSystem::OddR }>
impl OffsetCoordinates<{ OffsetSystem::OddR }>
pub const fn neighbor(&self, direction: Direction) -> Self
sourcepub const fn manhattan_distance(&self, other: Self) -> usize
pub const fn manhattan_distance(&self, other: Self) -> usize
Returns the manhattan distance between 2 coordinates.
sourcepub fn coordinate_range(&self, range: usize) -> Vec<Self>
pub fn coordinate_range(&self, range: usize) -> Vec<Self>
Returns all coordinates steps steps from self where { -range <= steps <= range }.
Panics
When isize::try_from(range).is_err().
sourceimpl OffsetCoordinates<{ OffsetSystem::EvenR }>
impl OffsetCoordinates<{ OffsetSystem::EvenR }>
pub const fn neighbor(&self, direction: Direction) -> Self
sourcepub const fn manhattan_distance(&self, other: Self) -> usize
pub const fn manhattan_distance(&self, other: Self) -> usize
Returns the manhattan distance between 2 coordinates.
sourcepub fn coordinate_range(&self, range: usize) -> Vec<Self>
pub fn coordinate_range(&self, range: usize) -> Vec<Self>
Returns all coordinates steps steps from self where { -range <= steps <= range }.
Panics
When isize::try_from(range).is_err().
sourceimpl OffsetCoordinates<{ OffsetSystem::OddQ }>
impl OffsetCoordinates<{ OffsetSystem::OddQ }>
pub const fn neighbor(&self, direction: Direction) -> Self
sourcepub const fn manhattan_distance(&self, other: Self) -> usize
pub const fn manhattan_distance(&self, other: Self) -> usize
Returns the manhattan distance between 2 coordinates.
sourcepub fn coordinate_range(&self, range: usize) -> Vec<Self>
pub fn coordinate_range(&self, range: usize) -> Vec<Self>
Returns all coordinates steps steps from self where { -range <= steps <= range }.
Panics
When isize::try_from(range).is_err().
sourceimpl OffsetCoordinates<{ OffsetSystem::EvenQ }>
impl OffsetCoordinates<{ OffsetSystem::EvenQ }>
pub const fn neighbor(&self, direction: Direction) -> Self
sourcepub const fn manhattan_distance(&self, other: Self) -> usize
pub const fn manhattan_distance(&self, other: Self) -> usize
Returns the manhattan distance between 2 coordinates.
sourcepub fn coordinate_range(&self, range: usize) -> Vec<Self>
pub fn coordinate_range(&self, range: usize) -> Vec<Self>
Returns all coordinates steps steps from self where { -range <= steps <= range }.
Panics
When isize::try_from(range).is_err().
Trait Implementations
sourceimpl<const S: OffsetSystem> Add<OffsetCoordinates<S>> for OffsetCoordinates<S>
impl<const S: OffsetSystem> Add<OffsetCoordinates<S>> for OffsetCoordinates<S>
type Output = OffsetCoordinates<S>
type Output = OffsetCoordinates<S>
The resulting type after applying the + operator.
sourceimpl<const S: OffsetSystem> AddAssign<OffsetCoordinates<S>> for OffsetCoordinates<S>
impl<const S: OffsetSystem> AddAssign<OffsetCoordinates<S>> for OffsetCoordinates<S>
sourceconst fn add_assign(&mut self, other: Self)
const fn add_assign(&mut self, other: Self)
Performs the += operation. Read more
sourceimpl<const S: OffsetSystem> Clone for OffsetCoordinates<S>
impl<const S: OffsetSystem> Clone for OffsetCoordinates<S>
sourcefn clone(&self) -> OffsetCoordinates<S>
fn clone(&self) -> OffsetCoordinates<S>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<const S: OffsetSystem> Debug for OffsetCoordinates<S>
impl<const S: OffsetSystem> Debug for OffsetCoordinates<S>
sourceimpl<const S: OffsetSystem> Default for OffsetCoordinates<S>
impl<const S: OffsetSystem> Default for OffsetCoordinates<S>
sourcefn default() -> OffsetCoordinates<S>
fn default() -> OffsetCoordinates<S>
Returns the “default value” for a type. Read more
sourceimpl<const S: OffsetSystem> Div<isize> for OffsetCoordinates<S>
impl<const S: OffsetSystem> Div<isize> for OffsetCoordinates<S>
sourceimpl<const S: OffsetSystem> DivAssign<isize> for OffsetCoordinates<S>
impl<const S: OffsetSystem> DivAssign<isize> for OffsetCoordinates<S>
sourceconst fn div_assign(&mut self, rhs: isize)
const fn div_assign(&mut self, rhs: isize)
Performs the /= operation. Read more
sourceimpl From<(Col, Direction)> for OffsetCoordinates<{ OffsetSystem::EvenQ }>
impl From<(Col, Direction)> for OffsetCoordinates<{ OffsetSystem::EvenQ }>
sourceimpl From<(Col, Direction)> for OffsetCoordinates<{ OffsetSystem::OddQ }>
impl From<(Col, Direction)> for OffsetCoordinates<{ OffsetSystem::OddQ }>
sourceimpl From<(Row, Direction)> for OffsetCoordinates<{ OffsetSystem::EvenR }>
impl From<(Row, Direction)> for OffsetCoordinates<{ OffsetSystem::EvenR }>
sourceimpl From<(Row, Direction)> for OffsetCoordinates<{ OffsetSystem::OddR }>
impl From<(Row, Direction)> for OffsetCoordinates<{ OffsetSystem::OddR }>
sourceimpl From<AxialCoordinates> for OffsetCoordinates<{ OffsetSystem::EvenQ }>
impl From<AxialCoordinates> for OffsetCoordinates<{ OffsetSystem::EvenQ }>
sourceconst fn from(_: AxialCoordinates) -> Self
const fn from(_: AxialCoordinates) -> Self
Converts to this type from the input type.
sourceimpl From<AxialCoordinates> for OffsetCoordinates<{ OffsetSystem::EvenR }>
impl From<AxialCoordinates> for OffsetCoordinates<{ OffsetSystem::EvenR }>
sourceconst fn from(_: AxialCoordinates) -> Self
const fn from(_: AxialCoordinates) -> Self
Converts to this type from the input type.
sourceimpl From<AxialCoordinates> for OffsetCoordinates<{ OffsetSystem::OddQ }>
impl From<AxialCoordinates> for OffsetCoordinates<{ OffsetSystem::OddQ }>
sourceconst fn from(_: AxialCoordinates) -> Self
const fn from(_: AxialCoordinates) -> Self
Converts to this type from the input type.
sourceimpl From<AxialCoordinates> for OffsetCoordinates<{ OffsetSystem::OddR }>
impl From<AxialCoordinates> for OffsetCoordinates<{ OffsetSystem::OddR }>
sourceconst fn from(_: AxialCoordinates) -> Self
const fn from(_: AxialCoordinates) -> Self
Converts to this type from the input type.
sourceimpl From<CubeCoordinates> for OffsetCoordinates<{ OffsetSystem::EvenQ }>
impl From<CubeCoordinates> for OffsetCoordinates<{ OffsetSystem::EvenQ }>
sourceconst fn from(_: CubeCoordinates) -> Self
const fn from(_: CubeCoordinates) -> Self
Converts to this type from the input type.
sourceimpl From<CubeCoordinates> for OffsetCoordinates<{ OffsetSystem::EvenR }>
impl From<CubeCoordinates> for OffsetCoordinates<{ OffsetSystem::EvenR }>
sourceconst fn from(_: CubeCoordinates) -> Self
const fn from(_: CubeCoordinates) -> Self
Converts to this type from the input type.
sourceimpl From<CubeCoordinates> for OffsetCoordinates<{ OffsetSystem::OddQ }>
impl From<CubeCoordinates> for OffsetCoordinates<{ OffsetSystem::OddQ }>
sourceconst fn from(_: CubeCoordinates) -> Self
const fn from(_: CubeCoordinates) -> Self
Converts to this type from the input type.
sourceimpl From<CubeCoordinates> for OffsetCoordinates<{ OffsetSystem::OddR }>
impl From<CubeCoordinates> for OffsetCoordinates<{ OffsetSystem::OddR }>
sourceconst fn from(_: CubeCoordinates) -> Self
const fn from(_: CubeCoordinates) -> Self
Converts to this type from the input type.
sourceimpl<const S: OffsetSystem> From<OffsetCoordinates<S>> for Col
impl<const S: OffsetSystem> From<OffsetCoordinates<S>> for Col
sourceconst fn from(_: OffsetCoordinates<S>) -> Self
const fn from(_: OffsetCoordinates<S>) -> Self
Converts to this type from the input type.
sourceimpl<const S: OffsetSystem> From<OffsetCoordinates<S>> for Row
impl<const S: OffsetSystem> From<OffsetCoordinates<S>> for Row
sourceconst fn from(_: OffsetCoordinates<S>) -> Self
const fn from(_: OffsetCoordinates<S>) -> Self
Converts to this type from the input type.
sourceimpl From<OffsetCoordinates<{ OffsetSystem::EvenQ }>> for AxialCoordinates
impl From<OffsetCoordinates<{ OffsetSystem::EvenQ }>> for AxialCoordinates
sourceconst fn from(_: OffsetCoordinates<{ OffsetSystem::EvenQ }>) -> Self
const fn from(_: OffsetCoordinates<{ OffsetSystem::EvenQ }>) -> Self
Converts to this type from the input type.
sourceimpl From<OffsetCoordinates<{ OffsetSystem::EvenQ }>> for CubeCoordinates
impl From<OffsetCoordinates<{ OffsetSystem::EvenQ }>> for CubeCoordinates
sourceconst fn from(_: OffsetCoordinates<{ OffsetSystem::EvenQ }>) -> Self
const fn from(_: OffsetCoordinates<{ OffsetSystem::EvenQ }>) -> Self
Converts to this type from the input type.
sourceimpl From<OffsetCoordinates<{ OffsetSystem::EvenR }>> for AxialCoordinates
impl From<OffsetCoordinates<{ OffsetSystem::EvenR }>> for AxialCoordinates
sourceconst fn from(_: OffsetCoordinates<{ OffsetSystem::EvenR }>) -> Self
const fn from(_: OffsetCoordinates<{ OffsetSystem::EvenR }>) -> Self
Converts to this type from the input type.
sourceimpl From<OffsetCoordinates<{ OffsetSystem::EvenR }>> for CubeCoordinates
impl From<OffsetCoordinates<{ OffsetSystem::EvenR }>> for CubeCoordinates
sourceconst fn from(_: OffsetCoordinates<{ OffsetSystem::EvenR }>) -> Self
const fn from(_: OffsetCoordinates<{ OffsetSystem::EvenR }>) -> Self
Converts to this type from the input type.
sourceimpl From<OffsetCoordinates<{ OffsetSystem::OddQ }>> for AxialCoordinates
impl From<OffsetCoordinates<{ OffsetSystem::OddQ }>> for AxialCoordinates
sourceconst fn from(_: OffsetCoordinates<{ OffsetSystem::OddQ }>) -> Self
const fn from(_: OffsetCoordinates<{ OffsetSystem::OddQ }>) -> Self
Converts to this type from the input type.
sourceimpl From<OffsetCoordinates<{ OffsetSystem::OddQ }>> for CubeCoordinates
impl From<OffsetCoordinates<{ OffsetSystem::OddQ }>> for CubeCoordinates
sourceconst fn from(_: OffsetCoordinates<{ OffsetSystem::OddQ }>) -> Self
const fn from(_: OffsetCoordinates<{ OffsetSystem::OddQ }>) -> Self
Converts to this type from the input type.
sourceimpl From<OffsetCoordinates<{ OffsetSystem::OddR }>> for AxialCoordinates
impl From<OffsetCoordinates<{ OffsetSystem::OddR }>> for AxialCoordinates
sourceconst fn from(_: OffsetCoordinates<{ OffsetSystem::OddR }>) -> Self
const fn from(_: OffsetCoordinates<{ OffsetSystem::OddR }>) -> Self
Converts to this type from the input type.
sourceimpl From<OffsetCoordinates<{ OffsetSystem::OddR }>> for CubeCoordinates
impl From<OffsetCoordinates<{ OffsetSystem::OddR }>> for CubeCoordinates
sourceconst fn from(_: OffsetCoordinates<{ OffsetSystem::OddR }>) -> Self
const fn from(_: OffsetCoordinates<{ OffsetSystem::OddR }>) -> Self
Converts to this type from the input type.
sourceimpl<const S: OffsetSystem> Mul<isize> for OffsetCoordinates<S>
impl<const S: OffsetSystem> Mul<isize> for OffsetCoordinates<S>
sourceimpl<const S: OffsetSystem> MulAssign<isize> for OffsetCoordinates<S>
impl<const S: OffsetSystem> MulAssign<isize> for OffsetCoordinates<S>
sourceconst fn mul_assign(&mut self, rhs: isize)
const fn mul_assign(&mut self, rhs: isize)
Performs the *= operation. Read more
sourceimpl<const S: OffsetSystem> PartialEq<OffsetCoordinates<S>> for OffsetCoordinates<S>
impl<const S: OffsetSystem> PartialEq<OffsetCoordinates<S>> for OffsetCoordinates<S>
sourcefn eq(&self, other: &OffsetCoordinates<S>) -> bool
fn eq(&self, other: &OffsetCoordinates<S>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourceimpl<const S: OffsetSystem> Sub<OffsetCoordinates<S>> for OffsetCoordinates<S>
impl<const S: OffsetSystem> Sub<OffsetCoordinates<S>> for OffsetCoordinates<S>
type Output = OffsetCoordinates<S>
type Output = OffsetCoordinates<S>
The resulting type after applying the - operator.
sourceimpl<const S: OffsetSystem> SubAssign<OffsetCoordinates<S>> for OffsetCoordinates<S>
impl<const S: OffsetSystem> SubAssign<OffsetCoordinates<S>> for OffsetCoordinates<S>
sourceconst fn sub_assign(&mut self, other: Self)
const fn sub_assign(&mut self, other: Self)
Performs the -= operation. Read more
impl<const S: OffsetSystem> Copy for OffsetCoordinates<S>
impl<const S: OffsetSystem> Eq for OffsetCoordinates<S>
impl<const S: OffsetSystem> StructuralEq for OffsetCoordinates<S>
impl<const S: OffsetSystem> StructuralPartialEq for OffsetCoordinates<S>
Auto Trait Implementations
impl<const S: OffsetSystem> RefUnwindSafe for OffsetCoordinates<S>
impl<const S: OffsetSystem> Send for OffsetCoordinates<S>
impl<const S: OffsetSystem> Sync for OffsetCoordinates<S>
impl<const S: OffsetSystem> Unpin for OffsetCoordinates<S>
impl<const S: OffsetSystem> UnwindSafe for OffsetCoordinates<S>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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