Skip to main content

LengthUnit

Enum LengthUnit 

Source
pub enum LengthUnit {
Show 49 variants Px, Cm, Mm, Q, In, Pc, Pt, Em, Rem, Ex, Rex, Cap, Rcap, Ch, Rch, Ic, Ric, Lh, Rlh, Vw, Vh, Vi, Vb, Vmin, Vmax, Svw, Svh, Svi, Svb, Svmin, Svmax, Lvw, Lvh, Lvi, Lvb, Lvmin, Lvmax, Dvw, Dvh, Dvi, Dvb, Dvmin, Dvmax, Cqw, Cqh, Cqi, Cqb, Cqmin, Cqmax,
}
Expand description

A CSS length unit.

Variants§

§

Px

CSS pixels (px), 1/96th of an inch.

§

Cm

Centimeters (cm).

§

Mm

Millimeters (mm), 1/10th of a centimeter.

§

Q

Quarter-millimeters (Q), 1/40th of a centimeter.

§

In

Inches (in), 2.54 centimeters.

§

Pc

Picas (pc), 1/6th of an inch.

§

Pt

Points (pt), 1/72nd of an inch.

§

Em

The element’s font size (em).

§

Rem

The root element’s font size (rem).

§

Ex

The x-height of the element’s font (ex).

§

Rex

The x-height of the root element’s font (rex).

§

Cap

The cap height of the element’s font (cap).

§

Rcap

The cap height of the root element’s font (rcap).

§

Ch

The advance of the 0 glyph in the element’s font (ch).

§

Rch

The advance of the 0 glyph in the root element’s font (rch).

§

Ic

The advance of a fullwidth glyph in the element’s font (ic).

§

Ric

The advance of a fullwidth glyph in the root element’s font (ric).

§

Lh

The line height of the element (lh).

§

Rlh

The line height of the root element (rlh).

§

Vw

1% of the viewport’s width (vw).

§

Vh

1% of the viewport’s height (vh).

§

Vi

1% of the viewport’s inline-axis size (vi).

§

Vb

1% of the viewport’s block-axis size (vb).

§

Vmin

1% of the viewport’s smaller dimension (vmin).

§

Vmax

1% of the viewport’s larger dimension (vmax).

§

Svw

1% of the small viewport’s width (svw).

§

Svh

1% of the small viewport’s height (svh).

§

Svi

1% of the small viewport’s inline-axis size (svi).

§

Svb

1% of the small viewport’s block-axis size (svb).

§

Svmin

1% of the small viewport’s smaller dimension (svmin).

§

Svmax

1% of the small viewport’s larger dimension (svmax).

§

Lvw

1% of the large viewport’s width (lvw).

§

Lvh

1% of the large viewport’s height (lvh).

§

Lvi

1% of the large viewport’s inline-axis size (lvi).

§

Lvb

1% of the large viewport’s block-axis size (lvb).

§

Lvmin

1% of the large viewport’s smaller dimension (lvmin).

§

Lvmax

1% of the large viewport’s larger dimension (lvmax).

§

Dvw

1% of the dynamic viewport’s width (dvw).

§

Dvh

1% of the dynamic viewport’s height (dvh).

§

Dvi

1% of the dynamic viewport’s inline-axis size (dvi).

§

Dvb

1% of the dynamic viewport’s block-axis size (dvb).

§

Dvmin

1% of the dynamic viewport’s smaller dimension (dvmin).

§

Dvmax

1% of the dynamic viewport’s larger dimension (dvmax).

§

Cqw

1% of the query container’s width (cqw).

§

Cqh

1% of the query container’s height (cqh).

§

Cqi

1% of the query container’s inline size (cqi).

§

Cqb

1% of the query container’s block size (cqb).

§

Cqmin

1% of the query container’s smaller dimension (cqmin).

§

Cqmax

1% of the query container’s larger dimension (cqmax).

Implementations§

Source§

impl LengthUnit

Source

pub const fn as_str(self) -> &'static str

Returns the CSS suffix for this unit, such as "px" or "rem".

Trait Implementations§

Source§

impl Clone for LengthUnit

Source§

fn clone(&self) -> LengthUnit

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for LengthUnit

Source§

impl Debug for LengthUnit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for LengthUnit

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for LengthUnit

Source§

impl PartialEq for LengthUnit

Source§

fn eq(&self, other: &LengthUnit) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LengthUnit

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneAny for T
where T: Any + Clone,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.