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 the other orientation.

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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.