pub enum Value {
Show 16 variants Bang(String), Call(StringCallArgs), Function(StringOption<Function>), Literal(CssString), List(Vec<Value>, Option<ListSeparator>, bool), Numeric(Numericbool), Color(ColorOption<String>), Null, True, False, BinOp(Box<Value>, boolOperatorboolBox<Value>), UnaryOp(OperatorBox<Value>), Map(ValueMap), UnicodeRange(String), Paren(Box<Value>), ArgList(CallArgs),
}
Expand description

A css value.

Variants

Bang(String)

A special kind of escape. Only really used for !important.

Call(StringCallArgs)

An function call that was not evaluated.

Function(StringOption<Function>)

A (callable?) function.

Literal(CssString)

A string literal.

List(Vec<Value>, Option<ListSeparator>, bool)

A comma- or space separated list of values, with or without brackets.

Numeric(Numericbool)

A Numeric value is a rational value with a Unit (which may be Unit::None) and flags.

The boolean flag is true for calculated values and false for literal values.

Color(ColorOption<String>)

A color value (and optionally, its source string).

Null

The null value.

True

The true boolean value.

False

The false boolean value.

BinOp(Box<Value>, boolOperatorboolBox<Value>)

A binary operation, two operands and an operator. The booleans represents possible whitespace.

UnaryOp(OperatorBox<Value>)

A unary operator and its operand.

Map(ValueMap)

A map of values.

UnicodeRange(String)

A unicode range for font selections. U+NN, U+N?, U+NN-MM. The string is the entire value, including the “U+” tag.

Paren(Box<Value>)

A value in parenthesis.

ArgList(CallArgs)

An argumentt list

Implementations

Create a numeric value with no unit.

Get the type name of this value.

Return true if this is a calculated value.

The return of functions or operators are calculated, verbatim values are not.

Get this value, but marked as calculated.

Make sure arithmetic operators are evaluated.

All values other than False and Null should be considered true.

Return true if this value is null.

Note that an empty unquoted string and a list containing no non-null values is also considered null.

Check if this value is numeric.

If it is, get the number and unit, otherwise, get the value itself as error.

Unquote this value.

If the value is a quoted string, the content is unquoted.

Get this value as iterable items.

Lists and maps have iterable items, which are returned as a vector of values. Other values are returned as a vec containing the value as a single item.

Get a reference to this Value bound to an output format.

The bound referene implements Display, so it can be written with the rust format!(...) macros or coverted with the to_string()` method.

Example
assert_eq!(
    Value::scalar(42).format(Default::default()).to_string(),
    "42",
);

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
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.

Create a css Value representing a set of selectors.

The result will be a comma-separated list of space-separated lists of strings, or null if this is a root (empty) selector.

Converts to this type from the input type.
Converts to this type from the input type.

Some Values are equal according to spec even with some implementation differences.

This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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
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.
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.
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.
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.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
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.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more