pub enum Arithmetic<T> {
Show 32 variants
Var(T),
Literal(isize),
Pow(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
PostIncr(T),
PostDecr(T),
PreIncr(T),
PreDecr(T),
UnaryPlus(Box<Arithmetic<T>>),
UnaryMinus(Box<Arithmetic<T>>),
LogicalNot(Box<Arithmetic<T>>),
BitwiseNot(Box<Arithmetic<T>>),
Mult(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
Div(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
Modulo(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
Add(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
Sub(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
ShiftLeft(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
ShiftRight(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
Less(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
LessEq(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
Great(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
GreatEq(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
Eq(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
NotEq(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
BitwiseAnd(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
BitwiseXor(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
BitwiseOr(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
LogicalAnd(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
LogicalOr(Box<Arithmetic<T>>, Box<Arithmetic<T>>),
Ternary(Box<Arithmetic<T>>, Box<Arithmetic<T>>, Box<Arithmetic<T>>),
Assign(T, Box<Arithmetic<T>>),
Sequence(Vec<Arithmetic<T>>),
}
Expand description
Represents an expression within an arithmetic subsitution.
Generic over the representation of a variable name.
Variants§
Var(T)
The value of a variable, e.g. $var
or var
.
Literal(isize)
A numeric literal such as 42
or 0xdeadbeef
.
Pow(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left ** right
.
PostIncr(T)
Returns the current value of a variable,
and then increments its value immediately after, e.g. var++
PostDecr(T)
Returns the current value of a variable,
and then decrements its value immediately after, e.g. var--
PreIncr(T)
Increments the value of a variable and returns the new value, e.g. ++var
.
PreDecr(T)
Decrements the value of a variable and returns the new value, e.g. --var
.
UnaryPlus(Box<Arithmetic<T>>)
Ensures the sign of the underlying result is positive, e.g. +(1-2)
.
UnaryMinus(Box<Arithmetic<T>>)
Ensures the sign of the underlying result is negative, e.g. -(1+2)
.
LogicalNot(Box<Arithmetic<T>>)
Returns one if the underlying result is zero, or zero otherwise, e.g. !expr
.
BitwiseNot(Box<Arithmetic<T>>)
Flips all bits from the underlying result, e.g. ~expr
.
Mult(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left * right
Div(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left / right
Modulo(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left % right
Add(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left + right
Sub(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left - right
ShiftLeft(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left << right
ShiftRight(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left >> right
Less(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left < right
LessEq(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left <= right
Great(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left > right
GreatEq(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left >= right
Eq(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left == right
NotEq(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left != right
BitwiseAnd(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left & right
BitwiseXor(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left ^ right
BitwiseOr(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left | right
LogicalAnd(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left && right
LogicalOr(Box<Arithmetic<T>>, Box<Arithmetic<T>>)
left || right
Ternary(Box<Arithmetic<T>>, Box<Arithmetic<T>>, Box<Arithmetic<T>>)
first ? second : third
Assign(T, Box<Arithmetic<T>>)
Assigns the value of an underlying expression to a
variable and returns the value, e.g. x = 5
, or x += 2
.
Sequence(Vec<Arithmetic<T>>)
expr[, expr[, ...]]
Trait Implementations§
Source§impl<T: Clone> Clone for Arithmetic<T>
impl<T: Clone> Clone for Arithmetic<T>
Source§fn clone(&self) -> Arithmetic<T>
fn clone(&self) -> Arithmetic<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more