pub enum Expr {
Const(Span<ConstantExpr>),
Range(RangeExpr),
Vector(Span<Vec<Expr>>),
Matrix(Span<Vec<Vec<ScalarExpr>>>),
SymbolAccess(SymbolAccess),
Binary(BinaryExpr),
Call(Call),
ListComprehension(ListComprehension),
Let(Box<Let>),
BusOperation(BusOperation),
Null(Span<()>),
Unconstrained(Span<()>),
}Expand description
Expressions which are valid in the body of a let statement, or in a function call.
Variants§
Const(Span<ConstantExpr>)
A constant expression
Range(RangeExpr)
An expression which evaluates to a vector of integers in the given range
Vector(Span<Vec<Expr>>)
A vector of expressions
A vector may be used to represent matrices in some situations, but such matrices must always be composed of scalar values. It is not permitted to have arbitrarily deep vectors.
Matrix(Span<Vec<Vec<ScalarExpr>>>)
A matrix of scalar expressions
SymbolAccess(SymbolAccess)
A reference to a named value of any type
Binary(BinaryExpr)
A binary operator over scalar values
Call(Call)
A call to a pure function
NOTE: This expression is only valid when the call is a pure function;
calls to evaluators are not permitted in an Expr context, as they do
not produce a value.
ListComprehension(ListComprehension)
A generator expression which produces a vector or matrix of values
Let(Box<Let>)
A let expression, used to bind temporaries in expression position during compilation.
NOTE: The AirScript syntax only permits let in statement position, so this variant
is only present in the AST as the result of an explicit transformation.
BusOperation(BusOperation)
A bus operation (p.insert(...) or p.remove(...))
Null(Span<()>)
An empty bus
Unconstrained(Span<()>)
An unconstrained bus
Implementations§
Trait Implementations§
Source§impl From<BinaryExpr> for Expr
impl From<BinaryExpr> for Expr
Source§fn from(expr: BinaryExpr) -> Self
fn from(expr: BinaryExpr) -> Self
Source§impl From<BusOperation> for Expr
impl From<BusOperation> for Expr
Source§fn from(expr: BusOperation) -> Self
fn from(expr: BusOperation) -> Self
Source§impl From<ListComprehension> for Expr
impl From<ListComprehension> for Expr
Source§fn from(expr: ListComprehension) -> Self
fn from(expr: ListComprehension) -> Self
Source§impl From<SymbolAccess> for Expr
impl From<SymbolAccess> for Expr
Source§fn from(expr: SymbolAccess) -> Self
fn from(expr: SymbolAccess) -> Self
Source§impl TryFrom<Expr> for ScalarExpr
impl TryFrom<Expr> for ScalarExpr
Source§impl TryFrom<ScalarExpr> for Expr
impl TryFrom<ScalarExpr> for Expr
Source§type Error = InvalidExprError
type Error = InvalidExprError
impl Eq for Expr
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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