pub enum PrincipalOrResourceConstraint {
Any,
In(EntityReference),
Eq(EntityReference),
Is(Arc<EntityType>),
IsIn(Arc<EntityType>, EntityReference),
}
Expand description
Represents the constraints for principals and resources.
Can either not constrain, or constrain via ==
or in
for a single entity literal.
Variants§
Any
Unconstrained
In(EntityReference)
Hierarchical constraint
Eq(EntityReference)
Equality constraint
Is(Arc<EntityType>)
Type constraint,
IsIn(Arc<EntityType>, EntityReference)
Type constraint with a hierarchy constraint
Implementations§
Source§impl PrincipalOrResourceConstraint
impl PrincipalOrResourceConstraint
Sourcepub fn is_eq_slot() -> Self
pub fn is_eq_slot() -> Self
Constrained to equal a slot
Sourcepub fn is_in_slot() -> Self
pub fn is_in_slot() -> Self
Constrained to be in a slot
Sourcepub fn is_entity_type_in_slot(entity_type: Arc<EntityType>) -> Self
pub fn is_entity_type_in_slot(entity_type: Arc<EntityType>) -> Self
Type constraint additionally constrained to be in a slot.
Sourcepub fn is_entity_type_in(
entity_type: Arc<EntityType>,
in_entity: Arc<EntityUID>,
) -> Self
pub fn is_entity_type_in( entity_type: Arc<EntityType>, in_entity: Arc<EntityUID>, ) -> Self
Type constraint with a hierarchical constraint.
Sourcepub fn is_entity_type(entity_type: Arc<EntityType>) -> Self
pub fn is_entity_type(entity_type: Arc<EntityType>) -> Self
Type constraint, with no hierarchical constraint or slot.
Sourcepub fn as_expr(&self, v: PrincipalOrResource) -> Expr
pub fn as_expr(&self, v: PrincipalOrResource) -> Expr
Sourcepub fn display(&self, v: PrincipalOrResource) -> String
pub fn display(&self, v: PrincipalOrResource) -> String
Sourcepub fn get_euid(&self) -> Option<&Arc<EntityUID>>
pub fn get_euid(&self) -> Option<&Arc<EntityUID>>
Get the entity uid in this constraint or None
if there are no uids in the constraint
Sourcepub fn iter_entity_type_names(&self) -> impl Iterator<Item = &EntityType>
pub fn iter_entity_type_names(&self) -> impl Iterator<Item = &EntityType>
Get an iterator over all of the entity type names in this constraint.
Trait Implementations§
Source§impl Clone for PrincipalOrResourceConstraint
impl Clone for PrincipalOrResourceConstraint
Source§fn clone(&self) -> PrincipalOrResourceConstraint
fn clone(&self) -> PrincipalOrResourceConstraint
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'de> Deserialize<'de> for PrincipalOrResourceConstraint
impl<'de> Deserialize<'de> for PrincipalOrResourceConstraint
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<PrincipalOrResourceConstraint> for PrincipalConstraint
impl From<PrincipalOrResourceConstraint> for PrincipalConstraint
Source§fn from(constraint: PrincipalOrResourceConstraint) -> PrincipalConstraint
fn from(constraint: PrincipalOrResourceConstraint) -> PrincipalConstraint
Converts to this type from the input type.
Source§impl From<PrincipalOrResourceConstraint> for ResourceConstraint
impl From<PrincipalOrResourceConstraint> for ResourceConstraint
Source§fn from(constraint: PrincipalOrResourceConstraint) -> ResourceConstraint
fn from(constraint: PrincipalOrResourceConstraint) -> ResourceConstraint
Converts to this type from the input type.
Source§impl Hash for PrincipalOrResourceConstraint
impl Hash for PrincipalOrResourceConstraint
Source§impl Ord for PrincipalOrResourceConstraint
impl Ord for PrincipalOrResourceConstraint
Source§fn cmp(&self, other: &PrincipalOrResourceConstraint) -> Ordering
fn cmp(&self, other: &PrincipalOrResourceConstraint) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for PrincipalOrResourceConstraint
impl PartialEq for PrincipalOrResourceConstraint
Source§fn eq(&self, other: &PrincipalOrResourceConstraint) -> bool
fn eq(&self, other: &PrincipalOrResourceConstraint) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.Source§impl PartialOrd for PrincipalOrResourceConstraint
impl PartialOrd for PrincipalOrResourceConstraint
Source§impl TryFrom<PrincipalConstraint> for PrincipalOrResourceConstraint
impl TryFrom<PrincipalConstraint> for PrincipalOrResourceConstraint
Source§type Error = FromJsonError
type Error = FromJsonError
The type returned in the event of a conversion error.
Source§fn try_from(
constraint: PrincipalConstraint,
) -> Result<PrincipalOrResourceConstraint, Self::Error>
fn try_from( constraint: PrincipalConstraint, ) -> Result<PrincipalOrResourceConstraint, Self::Error>
Performs the conversion.
Source§impl TryFrom<ResourceConstraint> for PrincipalOrResourceConstraint
impl TryFrom<ResourceConstraint> for PrincipalOrResourceConstraint
Source§type Error = FromJsonError
type Error = FromJsonError
The type returned in the event of a conversion error.
Source§fn try_from(
constraint: ResourceConstraint,
) -> Result<PrincipalOrResourceConstraint, Self::Error>
fn try_from( constraint: ResourceConstraint, ) -> Result<PrincipalOrResourceConstraint, Self::Error>
Performs the conversion.
impl Eq for PrincipalOrResourceConstraint
impl StructuralPartialEq for PrincipalOrResourceConstraint
Auto Trait Implementations§
impl Freeze for PrincipalOrResourceConstraint
impl RefUnwindSafe for PrincipalOrResourceConstraint
impl Send for PrincipalOrResourceConstraint
impl Sync for PrincipalOrResourceConstraint
impl Unpin for PrincipalOrResourceConstraint
impl UnwindSafe for PrincipalOrResourceConstraint
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> 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)
🔬This is a nightly-only experimental API. (
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>
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