pub enum Expr {
Show 22 variants
F64 {
value: f64,
},
Int {
value: i64,
},
Bool {
value: bool,
},
Var {
name: String,
},
Array {
items: Vec<Expr>,
},
Index {
array: Box<Expr>,
index: Box<Expr>,
},
Len {
array: Box<Expr>,
},
Neg {
arg: Box<Expr>,
},
Not {
arg: Box<Expr>,
},
Add {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Sub {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Mul {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Div {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Eq {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Ne {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Lt {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Le {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Gt {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Ge {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
And {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Or {
lhs: Box<Expr>,
rhs: Box<Expr>,
},
Call {
func: String,
args: Vec<Expr>,
},
}Expand description
An expression. The JSON form is an object tagged by "op".
Variants§
F64
A float literal (2.0, 1e-3); must be finite.
Int
An integer literal (2).
Bool
true or false.
Var
A variable reference.
Array
An array literal [a, b, c] (its elements must evaluate to numbers).
Index
array[index].
Len
array.len().
Neg
-arg.
Not
!arg.
Add
lhs + rhs.
Sub
lhs - rhs.
Mul
lhs * rhs.
Div
lhs / rhs (always float division).
Eq
lhs == rhs.
Ne
lhs != rhs.
Lt
lhs < rhs.
Le
lhs <= rhs.
Gt
lhs > rhs.
Ge
lhs >= rhs.
And
lhs && rhs (short-circuit).
Or
lhs || rhs (short-circuit).
Call
A call of a registered pure function: exp(x), max(a, b).
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Expr
impl<'de> Deserialize<'de> for Expr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Expr
Prints the expression in text syntax with the minimal parentheses that
read back to the same tree.
impl Display for Expr
Prints the expression in text syntax with the minimal parentheses that read back to the same tree.
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more