[][src]Enum cursive::direction::Orientation

pub enum Orientation {
    Horizontal,
    Vertical,
}

Describes a vertical or horizontal orientation for a view.

Variants

Horizontal

Horizontal orientation

Vertical

Vertical orientation

Implementations

impl Orientation[src]

pub fn pair() -> XY<Orientation>[src]

Returns a XY(Horizontal, Vertical).

pub fn get<T>(self, v: &XY<T>) -> T where
    T: Clone
[src]

Returns the component of v corresponding to this orientation.

(Horizontal will return the x value, and Vertical will return the y value.)

pub fn swap(self) -> Orientation[src]

Returns the other orientation.

pub fn get_ref<T>(self, v: &mut XY<T>) -> &mut T[src]

Returns a mutable reference to the component of the given vector corresponding to this orientation.

Examples

let o = Orientation::Horizontal;
let mut xy = XY::new(1, 2);
*o.get_ref(&mut xy) = 42;

assert_eq!(xy, XY::new(42, 2));

pub fn stack<'a, T>(self, iter: T) -> XY<usize> where
    T: Iterator<Item = &'a XY<usize>>, 
[src]

Takes an iterator on sizes, and stack them in the current orientation, returning the size of the required bounding box.

  • For an horizontal view, returns (Sum(x), Max(y)).
  • For a vertical view, returns (Max(x), Sum(y)).

pub fn make_vec(self, main_axis: usize, second_axis: usize) -> XY<usize>[src]

Creates a new Vec2 with main_axis in self's axis, and second_axis for the other axis.

Examples

let o = Orientation::Horizontal;
let vec = o.make_vec(1, 2);

assert_eq!(vec, Vec2::new(1, 2));

let o = Orientation::Vertical;
let vec = o.make_vec(1, 2);

assert_eq!(vec, Vec2::new(2, 1));

Trait Implementations

impl Clone for Orientation[src]

impl Copy for Orientation[src]

impl Debug for Orientation[src]

impl PartialEq<Orientation> for Orientation[src]

impl StructuralPartialEq for Orientation[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> Erased for T

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

impl<T> With for T[src]