#[non_exhaustive]pub enum CssLength {
}Expand description
CSS length values with absolute and relative units.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Px(FiniteF64)
Pixels.
Em(FiniteF64)
Em units (relative to element font size).
Rem(FiniteF64)
Rem units (relative to root font size).
Vw(FiniteF64)
Viewport width units.
Vh(FiniteF64)
Viewport height units.
Vmin(FiniteF64)
Viewport minimum dimension units.
Vmax(FiniteF64)
Viewport maximum dimension units.
Ch(FiniteF64)
Character width units (width of the 0 glyph in the element’s font).
Dvw(FiniteF64)
Dynamic viewport width units (1dvw = 1% of the dynamic viewport width).
Unlike vw, adjusts when browser UI elements (e.g. mobile address bar) appear or disappear.
Dvh(FiniteF64)
Dynamic viewport height units (1dvh = 1% of the dynamic viewport height).
Unlike vh, adjusts when browser UI elements (e.g. mobile address bar) appear or disappear.
Svw(FiniteF64)
Small viewport width units (1svw = 1% of the smallest possible viewport width). Represents the viewport size when all dynamic browser UI is expanded/visible.
Svh(FiniteF64)
Small viewport height units (1svh = 1% of the smallest possible viewport height). Represents the viewport size when all dynamic browser UI is expanded/visible.
Lvw(FiniteF64)
Large viewport width units (1lvw = 1% of the largest possible viewport width). Represents the viewport size when all dynamic browser UI is retracted/hidden.
Lvh(FiniteF64)
Large viewport height units (1lvh = 1% of the largest possible viewport height). Represents the viewport size when all dynamic browser UI is retracted/hidden.
Cqw(FiniteF64)
Container query width units (1cqw = 1% of the nearest size container’s width).
Used with CSS container queries (@container).
Cqh(FiniteF64)
Container query height units (1cqh = 1% of the nearest size container’s height).
Used with CSS container queries (@container).
Implementations§
Source§impl CssLength
impl CssLength
Sourcepub fn try_map_value(
self,
f: impl FnOnce(f64) -> f64,
) -> Result<Self, InvalidCssNumber>
pub fn try_map_value( self, f: impl FnOnce(f64) -> f64, ) -> Result<Self, InvalidCssNumber>
Attempt to transform the value while preserving its unit and the finite-value invariant.
§Errors
Returns InvalidCssNumber::NonFinite if f produces NaN or infinity.
Trait Implementations§
impl Copy for CssLength
Source§impl CssWriteTo for CssLength
impl CssWriteTo for CssLength
Source§impl From<CssLength> for CssDimension
impl From<CssLength> for CssDimension
Source§impl From<CssLength> for CssDimensionExpr
impl From<CssLength> for CssDimensionExpr
impl StructuralPartialEq for CssLength
Auto Trait Implementations§
impl Freeze for CssLength
impl RefUnwindSafe for CssLength
impl Send for CssLength
impl Sync for CssLength
impl Unpin for CssLength
impl UnsafeUnpin for CssLength
impl UnwindSafe for CssLength
Blanket Implementations§
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
impl<T> CheckedCssValue for Twhere
T: CssWriteTo + Sealed,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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