pub trait OffsetPosition:
Eq
+ Hash
+ Clone
+ Add<Self::Offset, Output = Self, Output = Self>
+ Add<Self::Diagonal> {
type Offset: Neg<Output = Self::Offset> + Clone;
type Diagonal: Neg<Output = Self::Diagonal> + Clone;
// Required methods
fn all_offsets() -> impl Iterator<Item = Self::Offset>;
fn all_diagonals() -> impl Iterator<Item = Self::Diagonal>;
}Expand description
Position types for tiles that provides abstract access to all of the position’s adjacent positions.
Required Associated Types§
Required Methods§
Sourcefn all_offsets() -> impl Iterator<Item = Self::Offset>
fn all_offsets() -> impl Iterator<Item = Self::Offset>
An iterator over all offsets, giving access to all adjacent positions from any position by using position arithmetic: position + offset == adjacent position.
Sourcefn all_diagonals() -> impl Iterator<Item = Self::Diagonal>
fn all_diagonals() -> impl Iterator<Item = Self::Diagonal>
An iterator over all diagonals, giving access to nearby non-adjacent positions by using position arithmetic: position + diagonal == nearby position.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.