#[repr(C)]pub enum NumericValue {
Unit {
value: f32,
unit: CssString,
},
Sum {
values: ThinVec<NumericValue>,
},
}Expand description
A numeric value used by the Typed OM.
This corresponds to CSSNumericValue and its subclasses in the Typed OM
specification. It represents numbers that can appear in CSS values,
including both simple unit quantities and sums of numeric terms.
Unlike the parser-level representation, NumericValue is property-agnostic
and suitable for conversion to or from the CSSNumericValue family of DOM
objects.
Variants§
Unit
A single numeric value with a concrete unit.
This corresponds to CSSUnitValue. The value field stores the raw
numeric component, and the unit field stores the textual unit
identifier (e.g. "px", "em", "%", "deg").
Fields
Sum
A sum of multiple numeric values.
This corresponds to CSSMathSum, representing an expression such as
10px + 2em. Each entry in values is another NumericValue, which
may itself be a unit value or a nested sum.
Fields
values: ThinVec<NumericValue>The list of numeric terms that make up the sum.
Trait Implementations§
Source§impl Clone for NumericValue
impl Clone for NumericValue
Source§fn clone(&self) -> NumericValue
fn clone(&self) -> NumericValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more