[−][src]Enum cursive::direction::Orientation
Describes a vertical or horizontal orientation for a view.
Variants
Horizontal orientation
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]
T: Clone,
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]
T: Iterator<Item = &'a XY<usize>>,
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]
fn clone(&self) -> Orientation
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Orientation
[src]
impl Debug for Orientation
[src]
impl PartialEq<Orientation> for Orientation
[src]
fn eq(&self, other: &Orientation) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralPartialEq for Orientation
[src]
Auto Trait Implementations
impl RefUnwindSafe for Orientation
impl Send for Orientation
impl Sync for Orientation
impl Unpin for Orientation
impl UnwindSafe for Orientation
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[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]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.