pub enum WidgetLength {
Default,
Leftover(Factor),
Exact,
}Expand description
Represents the width or height property value set on a widget.
Properties like size, width and height set the WIDGET_SIZE
metadata in the widget state. Panels can use this info to implement Length::Leftover support.
Variants§
Default
Evaluates to PxConstraints2d::fill_size when measured, can serve as a request for size-to-fit.
The Grid! widget uses this to fit the column and row widgets to their cells, as they don’t
logically own the cells, this fit needs to be computed by the parent panel.
Leftover(Factor)
The Length::Leftover value. Evaluates to the LayoutMetrics::leftover value when measured, if
a leftover value is not provided evaluates like a Length::Factor.
The leftover length needs to be computed by the parent panel, as it depends on the length of the sibling widgets,
not just the panel constraints. Panels that support this, compute the value for each widget and measure/layout each using
LAYOUT.with_leftover to inject the computed value.
Exact
Any of the other Length kinds. All contextual metrics needed to compute these values is already available
in the LayoutMetrics, panels that support Length::Leftover can layout this widget first to compute the
leftover length.
Trait Implementations§
Source§impl Clone for WidgetLength
impl Clone for WidgetLength
Source§fn clone(&self) -> WidgetLength
fn clone(&self) -> WidgetLength
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for WidgetLength
impl Debug for WidgetLength
Source§impl Default for WidgetLength
impl Default for WidgetLength
Source§fn default() -> WidgetLength
fn default() -> WidgetLength
Source§impl<'de> Deserialize<'de> for WidgetLength
impl<'de> Deserialize<'de> for WidgetLength
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&Length> for WidgetLength
impl From<&Length> for WidgetLength
Source§impl PartialEq for WidgetLength
impl PartialEq for WidgetLength
Source§impl Serialize for WidgetLength
impl Serialize for WidgetLength
impl Copy for WidgetLength
impl StructuralPartialEq for WidgetLength
Auto Trait Implementations§
impl Freeze for WidgetLength
impl RefUnwindSafe for WidgetLength
impl Send for WidgetLength
impl Sync for WidgetLength
impl Unpin for WidgetLength
impl UnwindSafe for WidgetLength
Blanket Implementations§
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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> 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<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