pub enum Value {
Show 16 variants
Bang(String),
Call(SassString, CallArgs, SourcePos),
Literal(SassString),
List(Vec<Value>, Option<ListSeparator>, bool),
Numeric(Numeric),
Paren(Box<Value>, bool),
Variable(Name, SourcePos),
Color(Rgba, Option<String>),
Null,
True,
False,
BinOp(Box<BinOp>),
UnaryOp(Operator, Box<Value>),
Map(Vec<(Value, Value)>),
HereSelector,
UnicodeRange(String),
}
Expand description
A sass value.
Variants§
Bang(String)
A special kind of escape. Only really used for !important.
Call(SassString, CallArgs, SourcePos)
A call has a name and an argument (which may be multi).
Literal(SassString)
A literal string value (quoted or not).
List(Vec<Value>, Option<ListSeparator>, bool)
A comma- or space separated list of values, with or without brackets.
Numeric(Numeric)
A Numeric value is a rational value with a Unit (which may be Unit::None) and flags.
Paren(Box<Value>, bool)
“(a/b) and a/b differs semantically. Parens means the value should be evaluated numerically if possible, without parens / is not allways division. The boolean tells if the paren itself should be kept for output.
Variable(Name, SourcePos)
A variable reference to be loaded when the value is evaluated.
Color(Rgba, Option<String>)
Both a numerical and original string representation, since case and length should be preserved (#AbC vs #aabbcc).
Null
The null value.
True
The true boolean value.
False
The false boolean value.
BinOp(Box<BinOp>)
A binary operation, two operands and an operator.
UnaryOp(Operator, Box<Value>)
A unary operator and its operand.
Map(Vec<(Value, Value)>)
A map in sass source is just a list of key/value parirs. Actual map behaviour comes after evaluating it.
HereSelector
The magic value “&”, expanding to the current selectors.
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.
Implementations§
source§impl Value
impl Value
sourcepub fn is_null(&self) -> bool
pub fn is_null(&self) -> bool
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.
sourcepub fn evaluate(&self, scope: ScopeRef) -> Result<Value, Error>
pub fn evaluate(&self, scope: ScopeRef) -> Result<Value, Error>
Evaluate this value in a given scope.
sourcepub fn do_evaluate(
&self,
scope: ScopeRef,
arithmetic: bool
) -> Result<Value, Error>
pub fn do_evaluate( &self, scope: ScopeRef, arithmetic: bool ) -> Result<Value, Error>
Evaluate this value to a css::Value
.
Trait Implementations§
source§impl PartialEq for Value
impl PartialEq for Value
source§impl PartialOrd for Value
impl PartialOrd for Value
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 more