Struct cedar_policy::Template
source · pub struct Template { /* private fields */ }
Expand description
Policy template datatype
Implementations§
source§impl Template
impl Template
sourcepub fn parse(
id: Option<String>,
src: impl AsRef<str>,
) -> Result<Self, ParseErrors>
pub fn parse( id: Option<String>, src: impl AsRef<str>, ) -> Result<Self, ParseErrors>
Attempt to parse a Template
from source.
If id
is Some, then the resulting template will have that id
.
If the id
is None, the parser will use the default “policy0”.
The behavior around None may change in the future.
sourcepub fn annotation(&self, key: impl AsRef<str>) -> Option<&str>
pub fn annotation(&self, key: impl AsRef<str>) -> Option<&str>
Get an annotation value of this Template
sourcepub fn annotations(&self) -> impl Iterator<Item = (&str, &str)>
pub fn annotations(&self) -> impl Iterator<Item = (&str, &str)>
Iterate through annotation data of this Template
as key-value pairs
sourcepub fn slots(&self) -> impl Iterator<Item = &SlotId>
pub fn slots(&self) -> impl Iterator<Item = &SlotId>
Iterate over the open slots in this Template
sourcepub fn principal_constraint(&self) -> TemplatePrincipalConstraint
pub fn principal_constraint(&self) -> TemplatePrincipalConstraint
Get the head constraint on this policy’s principal
sourcepub fn action_constraint(&self) -> ActionConstraint
pub fn action_constraint(&self) -> ActionConstraint
Get the head constraint on this policy’s action
sourcepub fn resource_constraint(&self) -> TemplateResourceConstraint
pub fn resource_constraint(&self) -> TemplateResourceConstraint
Get the head constraint on this policy’s resource
Trait Implementations§
impl Eq for Template
Auto Trait Implementations§
impl Freeze for Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnwindSafe for Template
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.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