Enum cedar_policy_core::ast::ExprKind
source · pub enum ExprKind<T = ()> {
Show 15 variants
Lit(Literal),
Var(Var),
Slot(SlotId),
Unknown {
name: SmolStr,
type_annotation: Option<Type>,
},
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,
},
Set(Arc<Vec<Expr<T>>>),
Record {
pairs: Arc<Vec<(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
Symbolic Unknown for partial-eval
Fields
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
Set(Arc<Vec<Expr<T>>>)
Set (whose elements may be arbitrary expressions)
Record
Anonymous record (whose elements may be arbitrary expressions)
This is a Vec
for the same reason as above.
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