#[non_exhaustive]pub enum Length {
}Expand description
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Default
The default (initial) value.
Dip(Dip)
The exact length in device independent units.
Px(Px)
The exact length in device pixel units.
Pt(f32)
The exact length in font points.
Factor(Factor)
Relative to the fill length.
Leftover(Factor)
Relative to the leftover fill length.
Em(Factor)
Relative to the font-size of the widget.
RootEm(Factor)
Relative to the font-size of the root widget.
ViewportWidth(Factor)
Relative to the width of the nearest viewport ancestor.
ViewportHeight(Factor)
Relative to the height of the nearest viewport ancestor.
ViewportMin(Factor)
Relative to the smallest of the nearest viewport ancestor’s dimensions.
ViewportMax(Factor)
Relative to the smallest of the nearest viewport ancestor’s dimensions.
DipF32(f32)
The exact length in device independent units, defined using a f32 value.
This value will be rounded to the nearest pixel after layout, but it will be used as is in the evaluation of length expressions.
PxF32(f32)
The exact length in device pixel units, defined using a f32 value.
This value will be rounded to the nearest pixel after layout, but it will be used as is in the evaluation of length expressions.
Expr(Box<LengthExpr>)
Expression.
Implementations§
Source§impl Length
impl Length
Sourcepub fn max(&self, other: impl Into<Length>) -> Length
pub fn max(&self, other: impl Into<Length>) -> Length
Returns a length that resolves to the maximum layout length between self and other.
Sourcepub fn min(&self, other: impl Into<Length>) -> Length
pub fn min(&self, other: impl Into<Length>) -> Length
Returns a length that resolves to the minimum layout length between self and other.
Sourcepub fn clamp(&self, min: impl Into<Length>, max: impl Into<Length>) -> Length
pub fn clamp(&self, min: impl Into<Length>, max: impl Into<Length>) -> Length
Returns a length that constraints the computed layout length between min and max.
Sourcepub fn is_zero(&self) -> Option<bool>
pub fn is_zero(&self) -> Option<bool>
If this length is zero in any finite layout context.
Returns None if the value depends on the default value or is an expression.
Sourcepub fn pt_to_px(pt: f32, scale_factor: Factor) -> Px
pub fn pt_to_px(pt: f32, scale_factor: Factor) -> Px
Convert a pt unit value to Px given a scale_factor.
Sourcepub fn pt_to_px_f32(pt: f32, scale_factor: Factor) -> f32
pub fn pt_to_px_f32(pt: f32, scale_factor: Factor) -> f32
Same operation as pt_to_px but without rounding to nearest pixel.
Sourcepub fn px_to_pt(px: Px, scale_factor: Factor) -> f32
pub fn px_to_pt(px: Px, scale_factor: Factor) -> f32
Convert a Px unit value to a Pt value given a scale_factor.
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
If is Default.
Sourcepub fn has_default(&self) -> bool
pub fn has_default(&self) -> bool
Sourcepub fn replace_default(&mut self, overwrite: &Length)
pub fn replace_default(&mut self, overwrite: &Length)
Sourcepub fn memory_used(&self) -> ByteLength
pub fn memory_used(&self) -> ByteLength
Gets the total memory allocated by this length.
This includes the sum of all nested Length::Expr heap memory.
Sourcepub fn heap_memory_used(&self) -> ByteLength
pub fn heap_memory_used(&self) -> ByteLength
Sum total memory used in nested Length::Expr heap memory.
Trait Implementations§
Source§impl<L> AddAssign<L> for Length
impl<L> AddAssign<L> for Length
Source§fn add_assign(&mut self, rhs: L)
fn add_assign(&mut self, rhs: L)
+= operation. Read moreSource§impl<'de> Deserialize<'de> for Length
impl<'de> Deserialize<'de> for Length
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Length, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Length, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl<F> DivAssign<F> for Length
impl<F> DivAssign<F> for Length
Source§fn div_assign(&mut self, rhs: F)
fn div_assign(&mut self, rhs: F)
/= operation. Read moreSource§impl From<&Length> for WidgetLength
impl From<&Length> for WidgetLength
Source§fn from(value: &Length) -> WidgetLength
fn from(value: &Length) -> WidgetLength
Source§impl From<FactorPercent> for Length
impl From<FactorPercent> for Length
Source§fn from(percent: FactorPercent) -> Length
fn from(percent: FactorPercent) -> Length
Conversion to Length::Factor
Source§impl From<Length> for CornerRadius
impl From<Length> for CornerRadius
Source§fn from(all: Length) -> CornerRadius
fn from(all: Length) -> CornerRadius
All corners same length.
Source§impl From<Length> for GradientRadius
impl From<Length> for GradientRadius
Source§fn from(radius: Length) -> GradientRadius
fn from(radius: Length) -> GradientRadius
Ellipse GradientRadius::farthest_corner.
Source§impl From<Length> for GradientStop
impl From<Length> for GradientStop
Source§fn from(color_hint: Length) -> GradientStop
fn from(color_hint: Length) -> GradientStop
Source§impl From<Length> for GridSpacing
impl From<Length> for GridSpacing
Source§fn from(all: Length) -> GridSpacing
fn from(all: Length) -> GridSpacing
Same spacing for both columns and rows.
Source§impl From<Length> for SideOffsets
impl From<Length> for SideOffsets
Source§fn from(all: Length) -> SideOffsets
fn from(all: Length) -> SideOffsets
All sides equal.
Source§impl From<LengthExpr> for Length
impl From<LengthExpr> for Length
Source§fn from(expr: LengthExpr) -> Length
fn from(expr: LengthExpr) -> Length
Source§impl IntoVar<CornerRadius> for Length
impl IntoVar<CornerRadius> for Length
Source§fn into_var(self) -> Var<CornerRadius>
fn into_var(self) -> Var<CornerRadius>
All corners same length.
Source§impl IntoVar<GradientRadius> for Length
impl IntoVar<GradientRadius> for Length
Source§fn into_var(self) -> Var<GradientRadius>
fn into_var(self) -> Var<GradientRadius>
Ellipse GradientRadius::farthest_corner.
Source§impl IntoVar<GradientStop> for Length
impl IntoVar<GradientStop> for Length
fn into_var(self) -> Var<GradientStop>
Source§impl IntoVar<GridSpacing> for Length
impl IntoVar<GridSpacing> for Length
Source§fn into_var(self) -> Var<GridSpacing>
fn into_var(self) -> Var<GridSpacing>
Same spacing for both columns and rows.
Source§impl IntoVar<Indentation> for Length
impl IntoVar<Indentation> for Length
fn into_var(self) -> Var<Indentation>
Source§impl IntoVar<Length> for FactorPercent
impl IntoVar<Length> for FactorPercent
Source§impl IntoVar<SideOffsets> for Length
impl IntoVar<SideOffsets> for Length
Source§fn into_var(self) -> Var<SideOffsets>
fn into_var(self) -> Var<SideOffsets>
All sides equal.
Source§impl Layout1d for Length
impl Layout1d for Length
Source§fn layout_dft(&self, axis: LayoutAxis, default: Px) -> Px
fn layout_dft(&self, axis: LayoutAxis, default: Px) -> Px
LAYOUT context with default.Source§fn layout_f32_dft(&self, axis: LayoutAxis, default: f32) -> f32
fn layout_f32_dft(&self, axis: LayoutAxis, default: f32) -> f32
LAYOUT context with default.Source§fn affect_mask(&self) -> LayoutMask
fn affect_mask(&self) -> LayoutMask
LayoutMask that flags all contextual values that affect the result of layout.Source§fn layout(&self, axis: LayoutAxis) -> Px
fn layout(&self, axis: LayoutAxis) -> Px
LAYOUT context.Source§fn layout_dft_x(&self, default: Px) -> Px
fn layout_dft_x(&self, default: Px) -> Px
LAYOUT context x axis with default.Source§fn layout_dft_y(&self, default: Px) -> Px
fn layout_dft_y(&self, default: Px) -> Px
LAYOUT context y axis with default.Source§fn layout_dft_z(&self, default: Px) -> Px
fn layout_dft_z(&self, default: Px) -> Px
LAYOUT context z axis with default.Source§fn layout_f32(&self, axis: LayoutAxis) -> f32
fn layout_f32(&self, axis: LayoutAxis) -> f32
LAYOUT context.Source§fn layout_f32_x(&self) -> f32
fn layout_f32_x(&self) -> f32
LAYOUT context x axis.Source§fn layout_f32_y(&self) -> f32
fn layout_f32_y(&self) -> f32
LAYOUT context y axis.Source§fn layout_f32_z(&self) -> f32
fn layout_f32_z(&self) -> f32
LAYOUT context z axis.Source§fn layout_f32_dft_x(&self, default: f32) -> f32
fn layout_f32_dft_x(&self, default: f32) -> f32
LAYOUT context x axis with default.Source§impl<F> MulAssign<F> for Length
impl<F> MulAssign<F> for Length
Source§fn mul_assign(&mut self, rhs: F)
fn mul_assign(&mut self, rhs: F)
*= operation. Read moreSource§impl SelectorValue for Length
impl SelectorValue for Length
Source§impl Serialize for Length
impl Serialize for Length
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl<L> SubAssign<L> for Length
impl<L> SubAssign<L> for Length
Source§fn sub_assign(&mut self, rhs: L)
fn sub_assign(&mut self, rhs: L)
-= operation. Read moreSource§impl Transitionable for Length
impl Transitionable for Length
impl Eq for Length
impl IntoValue<CornerRadius> for Length
impl IntoValue<GradientRadius> for Length
impl IntoValue<GradientStop> for Length
impl IntoValue<GridSpacing> for Length
impl IntoValue<Indentation> for Length
impl IntoValue<Length> for Dip
impl IntoValue<Length> for Factor
impl IntoValue<Length> for FactorPercent
impl IntoValue<Length> for LengthExpr
impl IntoValue<Length> for Px
impl IntoValue<Length> for f32
impl IntoValue<Length> for i32
impl IntoValue<Point> for Length
impl IntoValue<SideOffsets> for Length
impl IntoValue<Size> for Length
impl IntoValue<Vector> 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 UnwindSafe for Length
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
Source§impl<T> DataNoteValue for T
impl<T> DataNoteValue for T
§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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> FsChangeNote for T
impl<T> FsChangeNote 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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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§impl<T> NoneValue for Twhere
T: Default,
impl<T> NoneValue for Twhere
T: Default,
type NoneType = T
§fn null_value() -> T
fn null_value() -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy. Read more