[−][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<T>(self, iter: T) -> XY<usize> where
T: Iterator<Item = XY<usize>>,
[src]
T: Iterator<Item = 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]
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>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
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) -> bool
1.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
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> With for T
[src]
pub fn wrap_with<U, F>(self, f: F) -> U where
F: FnOnce(Self) -> U,
[src]
F: FnOnce(Self) -> U,
pub fn with<F>(self, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),
pub fn try_with<E, F>(self, f: F) -> Result<Self, E> where
F: FnOnce(&mut Self) -> Result<(), E>,
[src]
F: FnOnce(&mut Self) -> Result<(), E>,
pub fn with_if<F>(self, condition: bool, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),