pub enum Expr {
Var(String),
Array(Vec<Expr>),
Index(Box<Expr>, Box<Expr>),
Int(i32),
Float(f32),
String(String),
Bool(bool),
Call(Box<Expr>, Vec<Expr>),
Unary(UnaryOp, Box<Expr>),
Binary(Box<Expr>, Vec<(BinaryOp, Expr)>),
Zero(Box<Type>),
}Expand description
A term that can be evaluated.
Example: f("224")
Variants§
Var(String)
A single variable.
Example: x
Array(Vec<Expr>)
An array, union or struct.
Example: { 1, 2, 3 }
Index(Box<Expr>, Box<Expr>)
Array indexing.
Example: x[8]
Int(i32)
A single 32-bit integer.
Example: 8
Float(f32)
A single-precision floating-point number.
Example: 3.6
String(String)
A string literal.
Example: "good"
Bool(bool)
A boolean literal.
Example: false
Call(Box<Expr>, Vec<Expr>)
A function call.
Example: f(x, y)
Unary(UnaryOp, Box<Expr>)
Application of unary operator.
Example: !false, x++
Binary(Box<Expr>, Vec<(BinaryOp, Expr)>)
Application of binary operator.
Example: a + b
Zero(Box<Type>)
Zero initializer.
Example: zeroinitializer
Implementations§
Trait Implementations§
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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more