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 Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§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