Enum rsass::css::Value[][src]

pub enum Value {
    Bang(String),
    Call(StringCallArgs),
    Function(StringOption<Function>),
    Literal(StringQuotes),
    List(Vec<Value>, ListSeparatorbool),
    Numeric(Numericbool),
    Color(ColorOption<String>),
    Null,
    True,
    False,
    BinOp(Box<Value>, boolOperatorboolBox<Value>),
    UnaryOp(OperatorBox<Value>),
    Map(OrderMap<Value, Value>),
    UnicodeRange(String),
    Paren(Box<Value>),
}

A css value.

Variants

Bang(String)

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

An function call that was not evaluated.

Function(StringOption<Function>)

A (callable?) function.

Literal(StringQuotes)

A string literal.

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(OrderMap<Value, Value>)

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.

Implementations

impl Value[src]

pub fn scalar<T: Into<Number>>(v: T) -> Self[src]

Create a numeric value with no unit.

pub fn type_name(&self) -> &'static str[src]

Get the type name of this value.

pub fn is_calculated(&self) -> bool[src]

Return true if this is a calculated value.

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

pub fn into_calculated(self) -> Self[src]

Get this value, but marked as calculated.

pub fn is_true(&self) -> bool[src]

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

pub fn is_null(&self) -> bool[src]

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.

pub fn numeric_value(self) -> Result<Numeric, Self>[src]

Check if this value is numeric.

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

pub fn integer_value(&self) -> Result<i64, Error>[src]

👎 Deprecated

Check that this value is an integer.

pub fn unquote(self) -> Value[src]

Unquote this value.

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

pub fn iter_items(self) -> Vec<Value>[src]

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.

pub fn format(&self, format: Format) -> Formatted<'_, Value>[src]

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

impl Clone for Value[src]

impl Debug for Value[src]

impl Eq for Value[src]

impl From<&'_ str> for Value[src]

impl<C: Into<Color>> From<C> for Value[src]

impl From<Numeric> for Value[src]

impl From<String> for Value[src]

impl From<bool> for Value[src]

impl PartialEq<Value> for Value[src]

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

impl PartialOrd<Value> for Value[src]

impl StructuralEq for Value[src]

Auto Trait Implementations

impl !RefUnwindSafe for Value

impl Send for Value

impl Sync for Value

impl Unpin for Value

impl !UnwindSafe for Value

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,