[][src]Trait kas::Directional

pub trait Directional: Copy + Sized + Debug + 'static {
    type Flipped: Directional;
    pub fn as_direction(self) -> Direction;

    pub fn is_vertical(self) -> bool { ... }
pub fn is_horizontal(self) -> bool { ... }
pub fn is_reversed(self) -> bool { ... } }

Trait over directional types

This trait has a variable implementation, Direction, and several fixed implementations, Right, Down, Left and Up.

Using a generic <D: Directional> allows compile-time substitution of direction information when parametrised with fixed implementations.

Associated Types

type Flipped: Directional[src]

Direction flipped over diagonal (i.e. Down ↔ Right)

This allows compile-time selection of the flipped direction.

Loading content...

Required methods

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

Convert to the Direction enum

Loading content...

Provided methods

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

Up or Down

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

Left or Right

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

Left or Up

Loading content...

Implementors

impl Directional for Direction[src]

type Flipped = Self

impl Directional for Down[src]

impl Directional for Left[src]

type Flipped = Up

impl Directional for Right[src]

type Flipped = Down

impl Directional for Up[src]

type Flipped = Left

Loading content...