pub type UnderlineThickness = Length;
Expand description
Height of the text underline decoration.
Relative lengths are computed from 1.em()
, with a minimum of one pixel.
The Default
value is defined by the font.
Aliased Type§
enum UnderlineThickness {
}
Variants§
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.
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 Length::Default
.
Sourcepub fn replace_default(&mut self, overwrite: &Length)
pub fn replace_default(&mut self, overwrite: &Length)
Replaces self
with overwrite
if self
is Default
.
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<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 IntoVar<CornerRadius> for Length
impl IntoVar<CornerRadius> for Length
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moreSource§impl IntoVar<GradientRadius> for Length
impl IntoVar<GradientRadius> for Length
Source§fn into_var(self) -> <Length as IntoVar<GradientRadius>>::Var
fn into_var(self) -> <Length as IntoVar<GradientRadius>>::Var
Ellipse GradientRadius::farthest_corner
.
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moreSource§impl IntoVar<GradientStop> for Length
impl IntoVar<GradientStop> for Length
Source§fn into_var(self) -> <Length as IntoVar<GradientStop>>::Var
fn into_var(self) -> <Length as IntoVar<GradientStop>>::Var
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moreSource§impl IntoVar<GridSpacing> for Length
impl IntoVar<GridSpacing> for Length
Source§fn into_var(self) -> <Length as IntoVar<GridSpacing>>::Var
fn into_var(self) -> <Length as IntoVar<GridSpacing>>::Var
Same spacing for both columns and rows.
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moreSource§impl IntoVar<SideOffsets> for Length
impl IntoVar<SideOffsets> for Length
Source§fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
fn into_boxed_var(self) -> Box<dyn VarBoxed<T>>where
Self: Sized,
BoxedVar<T>
. Read moreSource§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 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 more