pub struct PolicyFactory { /* private fields */ }
Implementations§
Source§impl PolicyFactory
impl PolicyFactory
Sourcepub async fn load(
source: impl AsyncRead + Unpin,
data: Data,
entrypoints: Entrypoints,
) -> Result<Self, LoadError>
pub async fn load( source: impl AsyncRead + Unpin, data: Data, entrypoints: Entrypoints, ) -> Result<Self, LoadError>
Load the policy from the given data source.
§Errors
Returns an error if the policy can’t be loaded or instantiated.
Sourcepub async fn set_dynamic_data(
&self,
dynamic_data: PolicyData,
) -> Result<bool, LoadError>
pub async fn set_dynamic_data( &self, dynamic_data: PolicyData, ) -> Result<bool, LoadError>
Set the dynamic data for the policy.
The dynamic_data
object is merged with the static data given when the
policy was loaded.
Returns true
if the data was updated, false
if the version
of the dynamic data was the same as the one we already have.
§Errors
Returns an error if the data can’t be merged with the static data, or if the policy can’t be instantiated with the new data.
Sourcepub async fn instantiate(&self) -> Result<Policy, InstantiateError>
pub async fn instantiate(&self) -> Result<Policy, InstantiateError>
Create a new policy instance.
§Errors
Returns an error if the policy can’t be instantiated with the current dynamic data.
Auto Trait Implementations§
impl !Freeze for PolicyFactory
impl !RefUnwindSafe for PolicyFactory
impl Send for PolicyFactory
impl Sync for PolicyFactory
impl Unpin for PolicyFactory
impl !UnwindSafe for PolicyFactory
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