pub enum Expr {
ExprNoExt(ExprNoExt),
ExtFuncCall(ExtFuncCall),
}
Expand description
Serde JSON structure for a Cedar expression in the EST format
Variants§
ExprNoExt(ExprNoExt)
Any Cedar expression other than an extension function call. We try to match this first, see docs on #[serde(untagged)].
ExtFuncCall(ExtFuncCall)
If that didn’t match (because the key is not one of the keys defined in
ExprNoExt
), we assume we have an extension function call, where the
key is the name of an extension function or method.
Implementations§
Source§impl Expr
impl Expr
Sourcepub fn lit(lit: CedarValueJson) -> Self
pub fn lit(lit: CedarValueJson) -> Self
literal
Sourcepub fn unknown(name: impl Into<SmolStr>) -> Self
pub fn unknown(name: impl Into<SmolStr>) -> Self
An extension call with one arg, which is the name of the unknown
Sourcepub fn contains_all(left: Arc<Expr>, right: Expr) -> Self
pub fn contains_all(left: Arc<Expr>, right: Expr) -> Self
left.containsAll(right)
Sourcepub fn contains_any(left: Arc<Expr>, right: Expr) -> Self
pub fn contains_any(left: Arc<Expr>, right: Expr) -> Self
left.containsAny(right)
Sourcepub fn like(left: Expr, pattern: impl IntoIterator<Item = PatternElem>) -> Self
pub fn like(left: Expr, pattern: impl IntoIterator<Item = PatternElem>) -> Self
left like pattern
Sourcepub fn is_entity_type(left: Expr, entity_type: SmolStr) -> Self
pub fn is_entity_type(left: Expr, entity_type: SmolStr) -> Self
left is entity_type
Sourcepub fn is_entity_type_in(left: Expr, entity_type: SmolStr, entity: Expr) -> Self
pub fn is_entity_type_in(left: Expr, entity_type: SmolStr, entity: Expr) -> Self
left is entity_type in entity
Sourcepub fn ite(cond_expr: Expr, then_expr: Expr, else_expr: Expr) -> Self
pub fn ite(cond_expr: Expr, then_expr: Expr, else_expr: Expr) -> Self
if cond_expr then then_expr else else_expr
Sourcepub fn record(map: HashMap<SmolStr, Expr>) -> Self
pub fn record(map: HashMap<SmolStr, Expr>) -> Self
e.g. {foo: 1+2, bar: !(context has department)}
Sourcepub fn ext_call(fn_name: SmolStr, args: Vec<Expr>) -> Self
pub fn ext_call(fn_name: SmolStr, args: Vec<Expr>) -> Self
extension function call, including method calls
Sourcepub fn into_string_literal(self) -> Result<SmolStr, Self>
pub fn into_string_literal(self) -> Result<SmolStr, Self>
Consume the Expr
, producing a string literal if it was a string literal, otherwise returns the literal in the Err
variant.
Sourcepub fn sub_entity_literals(
self,
mapping: &BTreeMap<EntityUID, EntityUID>,
) -> Result<Self, JsonDeserializationError>
pub fn sub_entity_literals( self, mapping: &BTreeMap<EntityUID, EntityUID>, ) -> Result<Self, JsonDeserializationError>
Substitute entity literals
Source§impl Expr
impl Expr
Sourcepub fn try_into_ast(self, id: PolicyID) -> Result<Expr, FromJsonError>
pub fn try_into_ast(self, id: PolicyID) -> Result<Expr, FromJsonError>
Attempt to convert this est::Expr
into an ast::Expr
id
: the ID of the policy this Expr
belongs to, used only for reporting errors
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>,
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§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