Enum cursive_core::direction::Orientation
source ·
[−]pub enum Orientation {
Horizontal,
Vertical,
}
Expand description
Describes a vertical or horizontal orientation for a view.
Variants
Horizontal
Horizontal orientation
Vertical
Vertical orientation
Implementations
Returns a XY(Horizontal, Vertical)
.
Returns the component of v
corresponding to this orientation.
(Horizontal
will return the x value,
and Vertical
will return the y value.)
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));
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))
.
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
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
Mutably borrows from an owned value. Read more