pub enum ExprKind<T = ()> {
Show 16 variants
Lit(Literal),
Var(Var),
Slot(SlotId),
Unknown(Unknown),
If {
test_expr: Arc<Expr<T>>,
then_expr: Arc<Expr<T>>,
else_expr: Arc<Expr<T>>,
},
And {
left: Arc<Expr<T>>,
right: Arc<Expr<T>>,
},
Or {
left: Arc<Expr<T>>,
right: Arc<Expr<T>>,
},
UnaryApp {
op: UnaryOp,
arg: Arc<Expr<T>>,
},
BinaryApp {
op: BinaryOp,
arg1: Arc<Expr<T>>,
arg2: Arc<Expr<T>>,
},
ExtensionFunctionApp {
fn_name: Name,
args: Arc<Vec<Expr<T>>>,
},
GetAttr {
expr: Arc<Expr<T>>,
attr: SmolStr,
},
HasAttr {
expr: Arc<Expr<T>>,
attr: SmolStr,
},
Like {
expr: Arc<Expr<T>>,
pattern: Pattern,
},
Is {
expr: Arc<Expr<T>>,
entity_type: EntityType,
},
Set(Arc<Vec<Expr<T>>>),
Record(Arc<BTreeMap<SmolStr, Expr<T>>>),
}
Expand description
The possible expression variants. This enum should be matched on by code recursively traversing the AST.
Variants§
Lit(Literal)
Literal value
Var(Var)
Variable
Slot(SlotId)
Template Slots
Unknown(Unknown)
Symbolic Unknown for partial-eval
If
Ternary expression
Fields
And
Boolean AND
Fields
Or
Boolean OR
Fields
UnaryApp
Application of a built-in unary operator (single parameter)
BinaryApp
Application of a built-in binary operator (two parameters)
Fields
ExtensionFunctionApp
Application of an extension function to n arguments INVARIANT (MethodStyleArgs): if op.style is MethodStyle then args cannot be empty. The first element of args refers to the subject of the method call Ideally, we find some way to make this non-representable.
Fields
GetAttr
Get an attribute of an entity, or a field of a record
Fields
HasAttr
Does the given expr
have the given attr
?
Fields
Like
Regex-like string matching similar to IAM’s StringLike
operator.
Fields
Is
Entity type test. Does the first argument have the entity type specified by the second argument.
Fields
entity_type: EntityType
The EntityType
used for the type membership test.
Set(Arc<Vec<Expr<T>>>)
Set (whose elements may be arbitrary expressions)
Record(Arc<BTreeMap<SmolStr, Expr<T>>>)
Anonymous record (whose elements may be arbitrary expressions)
Implementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for ExprKind<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for ExprKind<T>where
T: Deserialize<'de>,
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>,
impl<T: Eq> Eq for ExprKind<T>
impl<T> StructuralPartialEq for ExprKind<T>
Auto Trait Implementations§
impl<T> Freeze for ExprKind<T>
impl<T> RefUnwindSafe for ExprKind<T>where
T: RefUnwindSafe,
impl<T> Send for ExprKind<T>
impl<T> Sync for ExprKind<T>
impl<T> Unpin for ExprKind<T>
impl<T> UnwindSafe for ExprKind<T>where
T: RefUnwindSafe,
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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