pub enum Dir4 {
Up,
Down,
Left,
Right,
}Expand description
The four cardinal directions.
Variants§
Trait Implementations§
Source§impl Direction for Dir4
impl Direction for Dir4
Source§fn rotate_right(self) -> Dir4
fn rotate_right(self) -> Dir4
Returns a new
Direction which represents the given one being rotated “right” or clockwise by one unit.Source§fn rotate_left(self) -> Dir4
fn rotate_left(self) -> Dir4
Returns a new
Direction which represents the given one being rotated “left” or counter-clockwise by one unit.Source§fn rotate_right_90(self) -> Dir4
fn rotate_right_90(self) -> Dir4
Returns a new
Direction which represents the given one being rotated “right” or clockwise by 90 degrees.Source§fn rotate_left_90(self) -> Dir4
fn rotate_left_90(self) -> Dir4
Returns a new
Direction which represents the given one being rotated “left” or counter-clockwise by 90 degrees.Source§fn opposite(self) -> Dir4
fn opposite(self) -> Dir4
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 = Dir4>
fn iter() -> impl Iterator<Item = Dir4>
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 Dir4
impl Eq for Dir4
impl StructuralPartialEq for Dir4
Auto Trait Implementations§
impl Freeze for Dir4
impl RefUnwindSafe for Dir4
impl Send for Dir4
impl Sync for Dir4
impl Unpin for Dir4
impl UnwindSafe for Dir4
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