pub enum Dir8 {
Dir4(Dir4),
UpRight,
UpLeft,
DownRight,
DownLeft,
}Expand description
The four cardinal directions, plus the 4 diagonals in between.
Variants§
Trait Implementations§
Source§impl Direction for Dir8
impl Direction for Dir8
Source§fn rotate_right(self) -> Dir8
fn rotate_right(self) -> Dir8
Returns a new
Direction which represents the given one being rotated “right” or clockwise by one unit.Source§fn rotate_left(self) -> Dir8
fn rotate_left(self) -> Dir8
Returns a new
Direction which represents the given one being rotated “left” or counter-clockwise by one unit.Source§fn rotate_right_90(self) -> Dir8
fn rotate_right_90(self) -> Dir8
Returns a new
Direction which represents the given one being rotated “right” or clockwise by 90 degrees.Source§fn rotate_left_90(self) -> Dir8
fn rotate_left_90(self) -> Dir8
Returns a new
Direction which represents the given one being rotated “left” or counter-clockwise by 90 degrees.Source§fn opposite(self) -> Dir8
fn opposite(self) -> Dir8
Returns a new
Direction which represents the “opposite” of the given one. Can also be
seen as rotating the given one by 180 degrees.Source§fn iter() -> impl Iterator<Item = Dir8>
fn iter() -> impl Iterator<Item = Dir8>
Returns an iterator through all values of the
Direction, starting with Up and
proceeding clockwise.Source§fn iter_from(initial_dir: Self) -> impl Iterator<Item = Self>
fn iter_from(initial_dir: Self) -> impl Iterator<Item = Self>
Returns an iterator through all values of the
Direction, starting with the given
initial_dir and proceeding clockwise. Read moreSource§fn iter_valid_usizes_deltas(
curr: (usize, usize),
size: (usize, usize),
) -> impl Iterator<Item = (usize, usize)>
fn iter_valid_usizes_deltas( curr: (usize, usize), size: (usize, usize), ) -> impl Iterator<Item = (usize, usize)>
Similar to
apply_delta_to_usizes(), but iterates through all valid directions. A valid
direction is defined as any whose result is non-negative and is less than size in the
respective dimension. Read moreimpl Copy for Dir8
impl Eq for Dir8
impl StructuralPartialEq for Dir8
Auto Trait Implementations§
impl Freeze for Dir8
impl RefUnwindSafe for Dir8
impl Send for Dir8
impl Sync for Dir8
impl Unpin for Dir8
impl UnwindSafe for Dir8
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