Dir8

Enum Dir8 

Source
pub enum Dir8 {
    Dir4(Dir4),
    UpRight,
    UpLeft,
    DownRight,
    DownLeft,
}
Expand description

The four cardinal directions, plus the 4 diagonals in between.

Variants§

§

Dir4(Dir4)

§

UpRight

§

UpLeft

§

DownRight

§

DownLeft

Trait Implementations§

Source§

impl Clone for Dir8

Source§

fn clone(&self) -> Dir8

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Dir8

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Direction for Dir8

Source§

fn delta(self) -> (i8, i8)

Returns the (x, y) delta for one unit of the Direction.
Source§

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

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

Returns a new Direction which represents the given one being rotated “right” or clockwise by 90 degrees.
Source§

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

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>

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>

Returns an iterator through all values of the Direction, starting with the given initial_dir and proceeding clockwise. Read more
Source§

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 more
Source§

fn apply_delta_to_usizes(self, usizes: (usize, usize)) -> (usize, usize)

Takes in a pair of usizes representing (x, y) coordinates, and returns the result of “moving” one unit in the given direction. Can panic (see usizes_plus_i() documentation). Read more
Source§

impl Hash for Dir8

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Dir8

Source§

fn eq(&self, other: &Dir8) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Dir8

Source§

impl Eq for Dir8

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.