pub enum LengthValue {
Show 43 variants Px(CSSNumber), In(CSSNumber), Cm(CSSNumber), Mm(CSSNumber), Q(CSSNumber), Pt(CSSNumber), Pc(CSSNumber), Em(CSSNumber), Rem(CSSNumber), Ex(CSSNumber), Rex(CSSNumber), Ch(CSSNumber), Rch(CSSNumber), Cap(CSSNumber), Rcap(CSSNumber), Ic(CSSNumber), Ric(CSSNumber), Lh(CSSNumber), Rlh(CSSNumber), Vw(CSSNumber), Lvw(CSSNumber), Svw(CSSNumber), Dvw(CSSNumber), Vh(CSSNumber), Lvh(CSSNumber), Svh(CSSNumber), Dvh(CSSNumber), Vi(CSSNumber), Svi(CSSNumber), Lvi(CSSNumber), Dvi(CSSNumber), Vb(CSSNumber), Svb(CSSNumber), Lvb(CSSNumber), Dvb(CSSNumber), Vmin(CSSNumber), Svmin(CSSNumber), Lvmin(CSSNumber), Dvmin(CSSNumber), Vmax(CSSNumber), Svmax(CSSNumber), Lvmax(CSSNumber), Dvmax(CSSNumber),
}
Expand description

A CSS <length> value, without support for calc(). See also: Length.

Variants

Px(CSSNumber)

A length in pixels.

In(CSSNumber)

A length in inches. 1in = 96px.

Cm(CSSNumber)

A length in centimeters. 1cm = 96px / 2.54.

Mm(CSSNumber)

A length in millimeters. 1mm = 1/10th of 1cm.

Q(CSSNumber)

A length in quarter-millimeters. 1Q = 1/40th of 1cm.

Pt(CSSNumber)

A length in points. 1pt = 1/72nd of 1in.

Pc(CSSNumber)

A length in picas. 1pc = 1/6th of 1in.

Em(CSSNumber)

A length in the em unit. An em is equal to the computed value of the font-size property of the element on which it is used.

Rem(CSSNumber)

A length in the rem unit. A rem is equal to the computed value of the em unit on the root element.

Ex(CSSNumber)

A length in ex unit. An ex is equal to the x-height of the font.

Rex(CSSNumber)

A length in the rex unit. A rex is equal to the value of the ex unit on the root element.

Ch(CSSNumber)

A length in the ch unit. A ch is equal to the width of the zero (“0”) character in the current font.

Rch(CSSNumber)

A length in the rch unit. An rch is equal to the value of the ch unit on the root element.

Cap(CSSNumber)

A length in the cap unit. A cap is equal to the cap-height of the font.

Rcap(CSSNumber)

A length in the rcap unit. An rcap is equal to the value of the cap unit on the root element.

Ic(CSSNumber)

A length in the ic unit. An ic is equal to the width of the “水” (CJK water ideograph) character in the current font.

Ric(CSSNumber)

A length in the ric unit. An ric is equal to the value of the ic unit on the root element.

Lh(CSSNumber)

A length in the lh unit. An lh is equal to the computed value of the line-height property.

Rlh(CSSNumber)

A length in the rlh unit. An rlh is equal to the value of the lh unit on the root element.

Vw(CSSNumber)

A length in the vw unit. A vw is equal to 1% of the viewport width.

Lvw(CSSNumber)

A length in the lvw unit. An lvw is equal to 1% of the large viewport width.

Svw(CSSNumber)

A length in the svw unit. An svw is equal to 1% of the small viewport width.

Dvw(CSSNumber)

A length in the dvw unit. An dvw is equal to 1% of the dynamic viewport width.

Vh(CSSNumber)

A length in the vh unit. A vh is equal to 1% of the viewport height.

Lvh(CSSNumber)

A length in the lvh unit. An lvh is equal to 1% of the large viewport height.

Svh(CSSNumber)

A length in the svh unit. An svh is equal to 1% of the small viewport height.

Dvh(CSSNumber)

A length in the dvh unit. An dvh is equal to 1% of the dynamic viewport height.

Vi(CSSNumber)

A length in the vi unit. A vi is equal to 1% of the viewport size in the box’s inline axis.

Svi(CSSNumber)

A length in the svi unit. A svi is equal to 1% of the small viewport size in the box’s inline axis.

Lvi(CSSNumber)

A length in the lvi unit. A lvi is equal to 1% of the large viewport size in the box’s inline axis.

Dvi(CSSNumber)

A length in the dvi unit. A dvi is equal to 1% of the dynamic viewport size in the box’s inline axis.

Vb(CSSNumber)

A length in the vb unit. A vb is equal to 1% of the viewport size in the box’s block axis.

Svb(CSSNumber)

A length in the svb unit. A svb is equal to 1% of the small viewport size in the box’s block axis.

Lvb(CSSNumber)

A length in the lvb unit. A lvb is equal to 1% of the large viewport size in the box’s block axis.

Dvb(CSSNumber)

A length in the dvb unit. A dvb is equal to 1% of the dynamic viewport size in the box’s block axis.

Vmin(CSSNumber)

A length in the vmin unit. A vmin is equal to the smaller of vw and vh.

Svmin(CSSNumber)

A length in the svmin unit. An svmin is equal to the smaller of svw and svh.

Lvmin(CSSNumber)

A length in the lvmin unit. An lvmin is equal to the smaller of lvw and lvh.

Dvmin(CSSNumber)

A length in the dvmin unit. A dvmin is equal to the smaller of dvw and dvh.

Vmax(CSSNumber)

A length in the vmax unit. A vmax is equal to the larger of vw and vh.

Svmax(CSSNumber)

A length in the svmax unit. An svmax is equal to the larger of svw and svh.

Lvmax(CSSNumber)

A length in the lvmax unit. An lvmax is equal to the larger of lvw and lvh.

Dvmax(CSSNumber)

A length in the dvmax unit. An dvmax is equal to the larger of dvw and dvh.

Implementations

Returns the numeric value and unit string for the length value.

Attempts to convert the value to pixels. Returns None if the conversion is not possible.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

Parse a value of this type using an existing parser.

Parse a value from a string. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize self in CSS syntax, writing to dest.

Serialize self in CSS syntax and return a string. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

The archived version of the pointer metadata for this type.

Converts some archived metadata to the pointer metadata for itself.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type for metadata in pointers and references to Self.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.