pub struct Policy<C> { /* private fields */ }
Expand description
An instance of a policy, ready to be executed
Implementations§
Source§impl<C> Policy<C>
impl<C> Policy<C>
Sourcepub async fn evaluate<V: Serialize, R: for<'de> Deserialize<'de>, T: Send>(
&self,
store: impl AsContextMut<Data = T>,
entrypoint: &str,
input: &V,
) -> Result<R>where
C: EvaluationContext,
pub async fn evaluate<V: Serialize, R: for<'de> Deserialize<'de>, T: Send>(
&self,
store: impl AsContextMut<Data = T>,
entrypoint: &str,
input: &V,
) -> Result<R>where
C: EvaluationContext,
Evaluate a policy with the given entrypoint and input.
§Errors
Returns an error if the policy evaluation failed, or if this policy did not belong to the given store.
Methods from Deref<Target = Runtime<C>>§
Sourcepub fn default_entrypoint(&self) -> Option<&str>
pub fn default_entrypoint(&self) -> Option<&str>
Get the default entrypoint of this module. May return None
if no
entrypoint with ID 0 was found
Sourcepub fn entrypoints(&self) -> HashSet<&str>
pub fn entrypoints(&self) -> HashSet<&str>
Get the list of entrypoints found in this module.
Sourcepub fn abi_version(&self) -> AbiVersion
pub fn abi_version(&self) -> AbiVersion
Get the ABI version detected for this module
Trait Implementations§
Auto Trait Implementations§
impl<C> Freeze for Policy<C>
impl<C> !RefUnwindSafe for Policy<C>
impl<C> Send for Policy<C>where
C: Send,
impl<C> Sync for Policy<C>where
C: Send,
impl<C> Unpin for Policy<C>
impl<C> !UnwindSafe for Policy<C>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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