#[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: Into<Length>> AddAssign<L> for Length
impl<L: Into<Length>> 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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<F: Into<Factor>> DivAssign<F> for Length
impl<F: Into<Factor>> DivAssign<F> for Length
Source§fn div_assign(&mut self, rhs: F)
fn div_assign(&mut self, rhs: F)
/= operation. Read moreSource§impl From<FactorPercent> for Length
impl From<FactorPercent> for Length
Source§fn from(percent: FactorPercent) -> Self
fn from(percent: FactorPercent) -> Self
Conversion to Length::Factor
Source§impl From<Length> for GridSpacing
impl From<Length> for GridSpacing
Source§impl From<LengthExpr> for Length
impl From<LengthExpr> for Length
Source§fn from(expr: LengthExpr) -> Self
fn from(expr: LengthExpr) -> Self
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<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: Into<Factor>> MulAssign<F> for Length
impl<F: Into<Factor>> MulAssign<F> for Length
Source§fn mul_assign(&mut self, rhs: F)
fn mul_assign(&mut self, rhs: F)
*= operation. Read moreSource§impl<L: Into<Length>> SubAssign<L> for Length
impl<L: Into<Length>> 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
Source§fn lerp(self, to: &Self, step: EasingStep) -> Self
fn lerp(self, to: &Self, step: EasingStep) -> Self
self -> to by step.impl Eq for Length
impl IntoValue<GridSpacing> 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§
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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