Enum rsass::Value
[−]
[src]
pub enum Value { Call(String, CallArgs), Div(Box<Value>, Box<Value>, bool, bool), Literal(String, Quotes), List(Vec<Value>, ListSeparator), Numeric(Rational, Unit, bool), Paren(Box<Value>), Variable(String), Color(Rational, Rational, Rational, Rational, Option<String>), Null, True, False, BinOp(Box<Value>, Operator, Box<Value>), UnaryOp(Operator, Box<Value>), Interpolation(Box<Value>), }
A sass value.
Variants
Call(String, CallArgs)
A call has a name and an argument (which may be multi).
Div(Box<Value>, Box<Value>, bool, bool)
Sometimes an actual division, sometimes "a/b". In the later case, the booleans tell if there should be whitespace before / after the slash.
Literal(String, Quotes)
List(Vec<Value>, ListSeparator)
Numeric(Rational, Unit, bool)
A Numeric value is a rational value with a Unit (which may be Unit::None) and a flag which is true for calculated values and false for literal values.
Paren(Box<Value>)
"(a/b) and a/b differs semantically. Parens means the value should be evaluated numerically if possible, without parens / is not allways division.
Variable(String)
Color(Rational, Rational, Rational, Rational, Option<String>)
Both a numerical and original string representation, since case and length should be preserved (#AbC vs #aabbcc).
Null
True
False
BinOp(Box<Value>, Operator, Box<Value>)
A binary operation, two operands and an operator.
UnaryOp(Operator, Box<Value>)
Interpolation(Box<Value>)
Methods
impl Value
[src]
fn scalar(v: isize) -> Self
fn bool(v: bool) -> Self
fn black() -> Self
fn rgba(r: Rational, g: Rational, b: Rational, a: Rational) -> Self
fn type_name(&self) -> &'static str
fn is_calculated(&self) -> bool
fn is_true(&self) -> bool
All values other than False
and Null
should be considered true.
fn is_null(&self) -> bool
fn integer_value(&self) -> Result<isize, Error>
fn evaluate(&self, scope: &Scope) -> Value
fn do_evaluate(&self, scope: &Scope, arithmetic: bool) -> Value
Trait Implementations
impl Clone for Value
[src]
fn clone(&self) -> Value
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Value
[src]
impl PartialEq for Value
[src]
fn eq(&self, __arg_0: &Value) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Value) -> bool
This method tests for !=
.
impl Eq for Value
[src]
impl Display for Value
[src]
impl PartialOrd for Value
[src]
fn partial_cmp(&self, b: &Value) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more