Enum Length
pub enum Length {
Fit,
Fill,
FillPortion(u16),
Shrink,
Fixed(f32),
Bounded {
bounds: Bounds,
sizing: Sizing,
},
Fluid(Constraint),
}Expand description
The strategy used to fill space in a specific dimension.
Variants§
Fit
Fill the minimum amount of space based on the intrinsic size of the element; normally defined by its contents.
This is the default sizing strategy of most widgets.
Fill
Fill all the remaining space.
FillPortion(u16)
Fill a portion of the remaining space relative to other elements.
Let’s say we have two elements: one with FillPortion(2) and one with
FillPortion(3). The first will get 2 portions of the available space,
while the second one would get 3.
Length::Fill is equivalent to Length::FillPortion(1).
Shrink
Fill the least amount of space; compressing contents if possible.
Fixed(f32)
Fill a fixed amount of space in pixels.
Bounded
Fill a certain amount of space inside the given [Bounds] with some [Sizing] strategy.
Fields
bounds: BoundsThe [Bounds] of space that can be filled.
sizing: SizingThe [Sizing] strategy with which the [Bounds] should be filled.
Fluid(Constraint)
Fill the remaining space like Fill, but subject to a single
open-ended [Constraint].
Implementations§
§impl Length
impl Length
pub fn min(self, min: impl Into<Pixels>) -> Length
pub fn min(self, min: impl Into<Pixels>) -> Length
Returns a new Bounded length with the given minimum bounds.
pub fn max(self, max: impl Into<Pixels>) -> Length
pub fn max(self, max: impl Into<Pixels>) -> Length
Returns a new Bounded length with the given maximum bounds.
pub fn fill_factor(&self) -> u16
pub fn fill_factor(&self) -> u16
Returns the fill factor of the Length.
The fill factor is a relative unit describing how much of the remaining space should be filled when compared to other elements. It is only meant to be used by layout engines.
pub fn is_fill(&self) -> bool
pub fn is_fill(&self) -> bool
Returns true if the Length is either Length::Fill or
Length::FillPortion.
pub fn stack(self, other: Length) -> Length
pub fn stack(self, other: Length) -> Length
Stacks the constraints of the current Length with the given one, if applicable.
Specifically, minimum constraints will be added together and accumulated.
You should use this when a container lays out multiple elements along a given axis and need to inherit their constraints in the main axis.
pub fn cross(self, other: Length) -> Length
pub fn cross(self, other: Length) -> Length
Crosses the constraints of the current Length with the given one, if applicable.
Specifically, minimum constraints will be compared and the maximum will be returned.
You should use this when a container lays out multiple elements along a given axis and need to inherit their constraints in the cross axis.
Trait Implementations§
impl Copy for Length
impl StructuralPartialEq for Length
Auto Trait Implementations§
impl Freeze for Length
impl RefUnwindSafe for Length
impl Send for Length
impl Sync for Length
impl Unpin for Length
impl UnsafeUnpin for Length
impl UnwindSafe for Length
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more