[][src]Enum gridly::direction::Direction

pub enum Direction {
    Up,
    Down,
    Left,
    Right,
}

The four cardinal directions (up, down, left, right).

Variants

Up

The negative row direction

Down

The positive row direction

Left

The negative column direction

Right

The positive column direction

Methods

impl Direction[src]

pub fn sized_vec(self, length: isize) -> Vector[src]

Return a vector with the given length in this direction

pub fn unit_vec(self) -> Vector[src]

Return the unit vector in the given direction

pub fn is_vertical(self) -> bool[src]

True if this is Up or Down

pub fn is_horizontal(self) -> bool[src]

True if this is Left or Right

pub fn reverse(self) -> Direction[src]

Reverse this direction (Up -> Down, etc)

pub fn clockwise(self) -> Direction[src]

Rotate this direction clockwise

pub fn counter_clockwise(self) -> Direction[src]

Rotate this direction counterclockwise

Trait Implementations

impl Copy for Direction[src]

impl PartialEq<Direction> for Direction[src]

#[must_use]
default fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Eq for Direction[src]

impl Clone for Direction[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl From<Direction> for Vector[src]

Convert a Direction into a unit vector pointing in that direction

impl Hash for Direction[src]

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

Feeds a slice of this type into the given [Hasher]. Read more

impl Mul<isize> for Direction[src]

type Output = Vector

The resulting type after applying the * operator.

impl Neg for Direction[src]

type Output = Direction

The resulting type after applying the - operator.

impl Debug for Direction[src]

Auto Trait Implementations

impl Send for Direction

impl Sync for Direction

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.