Struct cedar_policy_core::ast::Entity
source · pub struct Entity { /* private fields */ }
Expand description
Entity datatype
Implementations§
source§impl Entity
impl Entity
sourcepub fn new(
uid: EntityUID,
attrs: HashMap<SmolStr, RestrictedExpr>,
ancestors: HashSet<EntityUID>,
extensions: &Extensions<'_>
) -> Result<Self, EntityAttrEvaluationError>
pub fn new( uid: EntityUID, attrs: HashMap<SmolStr, RestrictedExpr>, ancestors: HashSet<EntityUID>, extensions: &Extensions<'_> ) -> Result<Self, EntityAttrEvaluationError>
Create a new Entity
with this UID, attributes, and ancestors
sourcepub fn new_with_attr_partial_value(
uid: EntityUID,
attrs: HashMap<SmolStr, PartialValue>,
ancestors: HashSet<EntityUID>
) -> Self
pub fn new_with_attr_partial_value( uid: EntityUID, attrs: HashMap<SmolStr, PartialValue>, ancestors: HashSet<EntityUID> ) -> Self
Create a new Entity
with this UID, attributes, and ancestors.
Unlike in Entity::new()
, in this constructor, attributes are expressed
as PartialValue
.
sourcepub fn new_with_attr_partial_value_serialized_as_expr(
uid: EntityUID,
attrs: HashMap<SmolStr, PartialValueSerializedAsExpr>,
ancestors: HashSet<EntityUID>
) -> Self
pub fn new_with_attr_partial_value_serialized_as_expr( uid: EntityUID, attrs: HashMap<SmolStr, PartialValueSerializedAsExpr>, ancestors: HashSet<EntityUID> ) -> Self
Create a new Entity
with this UID, attributes, and ancestors.
Unlike in Entity::new()
, in this constructor, attributes are expressed
as PartialValueSerializedAsExpr
.
sourcepub fn get(&self, attr: &str) -> Option<&PartialValue>
pub fn get(&self, attr: &str) -> Option<&PartialValue>
Get the value for the given attribute, or None
if not present
sourcepub fn is_descendant_of(&self, e: &EntityUID) -> bool
pub fn is_descendant_of(&self, e: &EntityUID) -> bool
Is this Entity
a descendant of e
in the entity hierarchy?
sourcepub fn ancestors(&self) -> impl Iterator<Item = &EntityUID>
pub fn ancestors(&self) -> impl Iterator<Item = &EntityUID>
Iterate over this entity’s ancestors
sourcepub fn attrs(&self) -> impl Iterator<Item = (&SmolStr, &PartialValue)>
pub fn attrs(&self) -> impl Iterator<Item = (&SmolStr, &PartialValue)>
Iterate over this entity’s attributes
Trait Implementations§
source§impl PartialEq for Entity
impl PartialEq for Entity
source§impl TCNode<EntityUID> for Entity
impl TCNode<EntityUID> for Entity
source§fn add_edge_to(&mut self, k: EntityUID)
fn add_edge_to(&mut self, k: EntityUID)
Add an edge out off this node to the node with key
k
.source§fn out_edges(&self) -> Box<dyn Iterator<Item = &EntityUID> + '_>
fn out_edges(&self) -> Box<dyn Iterator<Item = &EntityUID> + '_>
Retrieve an iterator for the edges out of this node.
source§fn has_edge_to(&self, e: &EntityUID) -> bool
fn has_edge_to(&self, e: &EntityUID) -> bool
Return true when their is an edge between this node and the node with
key
k
.impl Eq for Entity
Auto Trait Implementations§
impl Freeze for Entity
impl RefUnwindSafe for Entity
impl Send for Entity
impl Sync for Entity
impl Unpin for Entity
impl UnwindSafe for Entity
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> 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