pub struct LiteralPolicy { /* private fields */ }Expand description
Represents either a static policy or a template linked policy.
Contains less rich information than Policy. In particular, this form is
easier to convert to/from the Protobuf representation of a Policy, because
it simply refers to the Template by its Id and does not contain a
reference to the Template itself.
Implementations§
Source§impl LiteralPolicy
impl LiteralPolicy
Sourcepub fn static_policy(template_id: PolicyID) -> Self
pub fn static_policy(template_id: PolicyID) -> Self
Create a LiteralPolicy representing a static policy with the given ID.
The policy set should also contain a (zero-slot) Template with the given ID.
Sourcepub fn template_linked_policy(
template_id: PolicyID,
link_id: PolicyID,
values: SlotEnv,
) -> Self
pub fn template_linked_policy( template_id: PolicyID, link_id: PolicyID, values: SlotEnv, ) -> Self
Create a LiteralPolicy representing a template-linked policy.
The policy set should also contain the associated Template.
Source§impl LiteralPolicy
impl LiteralPolicy
Sourcepub fn reify(
self,
templates: &LinkedHashMap<PolicyID, Arc<Template>>,
) -> Result<Policy, ReificationError>
pub fn reify( self, templates: &LinkedHashMap<PolicyID, Arc<Template>>, ) -> Result<Policy, ReificationError>
Attempt to reify this template linked policy. Ensures the linked template actually exists, replaces the id with a reference to the underlying template. Fails if the template does not exist. Consumes the policy.
Sourcepub fn template_id(&self) -> &PolicyID
pub fn template_id(&self) -> &PolicyID
Get the PolicyID of the template associated with this policy.
For static policies, this is just the static policy ID.
Trait Implementations§
Source§impl Clone for LiteralPolicy
impl Clone for LiteralPolicy
Source§fn clone(&self) -> LiteralPolicy
fn clone(&self) -> LiteralPolicy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LiteralPolicy
impl Debug for LiteralPolicy
Source§impl Display for LiteralPolicy
impl Display for LiteralPolicy
Source§impl From<Policy> for LiteralPolicy
impl From<Policy> for LiteralPolicy
Source§impl Hash for LiteralPolicy
impl Hash for LiteralPolicy
Source§impl PartialEq for LiteralPolicy
impl PartialEq for LiteralPolicy
impl Eq for LiteralPolicy
impl StructuralPartialEq for LiteralPolicy
Auto Trait Implementations§
impl Freeze for LiteralPolicy
impl RefUnwindSafe for LiteralPolicy
impl Send for LiteralPolicy
impl Sync for LiteralPolicy
impl Unpin for LiteralPolicy
impl UnwindSafe for LiteralPolicy
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§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
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>
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