Enum lightningcss::values::length::LengthValue
source · pub enum LengthValue {
Show 49 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),
Cqw(CSSNumber),
Vh(CSSNumber),
Lvh(CSSNumber),
Svh(CSSNumber),
Dvh(CSSNumber),
Cqh(CSSNumber),
Vi(CSSNumber),
Svi(CSSNumber),
Lvi(CSSNumber),
Dvi(CSSNumber),
Cqi(CSSNumber),
Vb(CSSNumber),
Svb(CSSNumber),
Lvb(CSSNumber),
Dvb(CSSNumber),
Cqb(CSSNumber),
Vmin(CSSNumber),
Svmin(CSSNumber),
Lvmin(CSSNumber),
Dvmin(CSSNumber),
Cqmin(CSSNumber),
Vmax(CSSNumber),
Svmax(CSSNumber),
Lvmax(CSSNumber),
Dvmax(CSSNumber),
Cqmax(CSSNumber),
}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.
Cqw(CSSNumber)
A length in the cqw unit. An cqw is equal to 1% of the query container 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.
Cqh(CSSNumber)
A length in the cqh unit. An cqh is equal to 1% of the query container 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.
Cqi(CSSNumber)
A length in the cqi unit. An cqi is equal to 1% of the query container inline size.
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.
Cqb(CSSNumber)
A length in the cqb unit. An cqb is equal to 1% of the query container block size.
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.
Cqmin(CSSNumber)
A length in the cqmin unit. An cqmin is equal to the smaller of cqi and cqb.
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.
Cqmax(CSSNumber)
A length in the cqmax unit. An cqmin is equal to the larger of cqi and cqb.
Implementations§
source§impl LengthValue
impl LengthValue
sourcepub fn to_unit_value(&self) -> (CSSNumber, &str)
pub fn to_unit_value(&self) -> (CSSNumber, &str)
Returns the numeric value and unit string for the length value.
Trait Implementations§
source§impl Clone for LengthValue
impl Clone for LengthValue
source§fn clone(&self) -> LengthValue
fn clone(&self) -> LengthValue
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for LengthValue
impl Debug for LengthValue
source§impl<'de> Deserialize<'de> for LengthValue
impl<'de> Deserialize<'de> for LengthValue
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 IsCompatible for LengthValue
impl IsCompatible for LengthValue
source§fn is_compatible(&self, browsers: Browsers) -> bool
fn is_compatible(&self, browsers: Browsers) -> bool
source§impl JsonSchema for LengthValue
Available on crate feature jsonschema only.
impl JsonSchema for LengthValue
jsonschema only.source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read moresource§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
source§fn schema_name() -> String
fn schema_name() -> String
source§impl Map for LengthValue
impl Map for LengthValue
source§impl Mul<f32> for LengthValue
impl Mul<f32> for LengthValue
§type Output = LengthValue
type Output = LengthValue
* operator.source§impl<'i> Parse<'i> for LengthValue
impl<'i> Parse<'i> for LengthValue
source§fn parse<'t>(
input: &mut Parser<'i, 't>
) -> Result<Self, ParseError<'i, ParserError<'i>>>
fn parse<'t>( input: &mut Parser<'i, 't> ) -> Result<Self, ParseError<'i, ParserError<'i>>>
source§fn parse_string(input: &'i str) -> Result<Self, ParseError<'i, ParserError<'i>>>
fn parse_string(input: &'i str) -> Result<Self, ParseError<'i, ParserError<'i>>>
source§impl PartialEq<LengthValue> for LengthValue
impl PartialEq<LengthValue> for LengthValue
source§fn eq(&self, other: &LengthValue) -> bool
fn eq(&self, other: &LengthValue) -> bool
self and other values to be equal, and is used
by ==.source§impl PartialOrd<LengthValue> for LengthValue
impl PartialOrd<LengthValue> for LengthValue
source§fn partial_cmp(&self, other: &LengthValue) -> Option<Ordering>
fn partial_cmp(&self, other: &LengthValue) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moresource§impl Serialize for LengthValue
impl Serialize for LengthValue
source§impl Sign for LengthValue
impl Sign for LengthValue
source§impl ToCss for LengthValue
impl ToCss for LengthValue
source§fn to_css<W>(
&self,
dest: &mut Printer<'_, '_, '_, W>
) -> Result<(), PrinterError>where
W: Write,
fn to_css<W>( &self, dest: &mut Printer<'_, '_, '_, W> ) -> Result<(), PrinterError>where W: Write,
self in CSS syntax, writing to dest.source§fn to_css_string(
&self,
options: PrinterOptions<'_>
) -> Result<String, PrinterError>
fn to_css_string( &self, options: PrinterOptions<'_> ) -> Result<String, PrinterError>
self in CSS syntax and return a string. Read moresource§impl<'i> TryFrom<&Token<'i>> for LengthValue
impl<'i> TryFrom<&Token<'i>> for LengthValue
source§impl TryFrom<Angle> for LengthValue
impl TryFrom<Angle> for LengthValue
source§impl TryOp for LengthValue
impl TryOp for LengthValue
source§impl<'i, __T: Visit<'i, __T, __V>, __V: ?Sized + Visitor<'i, __T>> Visit<'i, __T, __V> for LengthValue
impl<'i, __T: Visit<'i, __T, __V>, __V: ?Sized + Visitor<'i, __T>> Visit<'i, __T, __V> for LengthValue
source§const CHILD_TYPES: VisitTypes = _
const CHILD_TYPES: VisitTypes = _
visitor only.