pub struct Policy { /* private fields */ }
Expand description
Serde JSON structure for policies and templates in the EST format
Note: Before attempting to build an est::Policy
from a cst::Policy
you
must first ensure that the CST can be transformed into an AST. The
CST-to-EST transformation does not duplicate all checks performed by the
CST-to-AST transformation, so attempting to convert an invalid CST to an EST
may succeed.
Implementations§
Source§impl Policy
impl Policy
Sourcepub fn link(
self,
vals: &HashMap<SlotId, EntityUidJson>,
) -> Result<Self, LinkingError>
pub fn link( self, vals: &HashMap<SlotId, EntityUidJson>, ) -> Result<Self, LinkingError>
Fill in any slots in the policy using the values in vals
. Throws an
error if vals
doesn’t contain a necessary mapping, but does not throw
an error if vals
contains unused mappings – and in particular if
self
is an inline policy (in which case it is returned unchanged).
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 Policy
impl Policy
Sourcepub fn try_into_ast_policy(
self,
id: Option<PolicyID>,
) -> Result<Policy, FromJsonError>
pub fn try_into_ast_policy( self, id: Option<PolicyID>, ) -> Result<Policy, FromJsonError>
Try to convert a Policy
into a ast::Policy
.
This process requires a policy ID. If not supplied, this method will fill it in as “JSON policy”.
Sourcepub fn try_into_ast_template(
self,
id: Option<PolicyID>,
) -> Result<Template, FromJsonError>
pub fn try_into_ast_template( self, id: Option<PolicyID>, ) -> Result<Template, FromJsonError>
Try to convert a Policy
into a ast::Template
. Returns an error
if the input is a static policy.
This process requires a policy ID. If not supplied, this method will fill it in as “JSON policy”.
Sourcepub fn try_into_ast_policy_or_template(
self,
id: Option<PolicyID>,
) -> Result<Template, FromJsonError>
pub fn try_into_ast_policy_or_template( self, id: Option<PolicyID>, ) -> Result<Template, FromJsonError>
Try to convert a Policy
into a ast::Template
. The Template
may
represent a template or static policy (which is a template with zero slots).
This process requires a policy ID. If not supplied, this method will fill it in as “JSON policy”.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Policy
impl<'de> Deserialize<'de> for Policy
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 Policy
Auto Trait Implementations§
impl Freeze for Policy
impl RefUnwindSafe for Policy
impl Send for Policy
impl Sync for Policy
impl Unpin for Policy
impl UnwindSafe for Policy
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