Trait kas::dir::Directional[][src]

pub trait Directional: 'static + Copy + Debug {
    type Flipped: Directional;
    type Reversed: Directional;
    fn flipped(self) -> Self::Flipped;
fn reversed(self) -> Self::Reversed;
fn as_direction(self) -> Direction; fn is_vertical(self) -> bool { ... }
fn is_horizontal(self) -> bool { ... }
fn is_reversed(self) -> bool { ... } }
Expand description

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

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

This allows compile-time selection of the flipped direction.

Direction reversed along axis (i.e. Left ↔ Right)

This allows compile-time selection of the reversed direction.

Required methods

Flip over diagonal (i.e. Down ↔ Right)

Reverse along axis (i.e. Left ↔ Right)

Convert to the Direction enum

Provided methods

Up or Down

Left or Right

Left or Up

Implementors