[−][src]Enum cursive_core::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: Clone>(self, v: &XY<T>) -> T[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) -> Self[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<T: Iterator<Item = Vec2>>(self, iter: T) -> Vec2[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) -> Vec2[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]
pub fn clone(&self) -> Orientation[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl Copy for Orientation[src]
impl Debug for Orientation[src]
impl Eq for Orientation[src]
impl Hash for Orientation[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl PartialEq<Orientation> for Orientation[src]
pub fn eq(&self, other: &Orientation) -> bool[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool1.0.0[src]
impl StructuralEq for Orientation[src]
impl StructuralPartialEq for Orientation[src]
Auto Trait Implementations
impl RefUnwindSafe for Orientation[src]
impl Send for Orientation[src]
impl Sync for Orientation[src]
impl Unpin for Orientation[src]
impl UnwindSafe for Orientation[src]
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,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> CallHasher for T where
T: Hash + ?Sized, [src]
T: Hash + ?Sized,
impl<T> Erased for T[src]
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.
pub fn to_owned(&self) -> T[src]
pub 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.
pub 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>,