[−][src]Struct allow_me::PolicyBuilder
A policy builder, responsible for parsing policy definition
and constructing Policy
struct.
It handles policy definition versioning and allows fine-grained
configuration of Policy
components.
Implementations
impl PolicyBuilder<DefaultValidator, Default, DefaultSubstituter>
[src]
pub fn from_json(
json: impl Into<String>
) -> PolicyBuilder<DefaultValidator, Default, DefaultSubstituter>
[src]
json: impl Into<String>
) -> PolicyBuilder<DefaultValidator, Default, DefaultSubstituter>
Constructs a PolicyBuilder
from provided json policy definition, with
default configuration.
Call to this method does not parse or validate the json, all heavy work
is done in build
method.
pub fn from_definition(
definition: PolicyDefinition
) -> PolicyBuilder<DefaultValidator, Default, DefaultSubstituter>
[src]
definition: PolicyDefinition
) -> PolicyBuilder<DefaultValidator, Default, DefaultSubstituter>
Constructs a PolicyBuilder
from provided policy definition struct, with
default configuration.
Call to this method does not validate the definition, all heavy work
is done in build
method.
impl<V, M, S, E> PolicyBuilder<V, M, S> where
V: PolicyValidator<Error = E>,
M: ResourceMatcher,
S: Substituter,
E: StdError + Sync + Into<Box<dyn StdError>> + 'static,
[src]
V: PolicyValidator<Error = E>,
M: ResourceMatcher,
S: Substituter,
E: StdError + Sync + Into<Box<dyn StdError>> + 'static,
pub fn with_validator<V1>(self, validator: V1) -> PolicyBuilder<V1, M, S>
[src]
Specifies the PolicyValidator
to validate the policy definition.
pub fn with_matcher<M1>(self, matcher: M1) -> PolicyBuilder<V, M1, S>
[src]
Specifies the ResourceMatcher
to use with Policy.
pub fn with_substituter<S1>(self, substituter: S1) -> PolicyBuilder<V, M, S1>
[src]
Specifies the Substituter
to use with Policy.
pub fn with_default_decision(self, decision: Decision) -> Self
[src]
Specifies the default decision that Policy
will return if
no rules match the request.
pub fn build(self) -> Result<Policy<M, S>>
[src]
Builds a Policy
consuming the builder.
This method does all the heavy lifting of deserializing json, validating and constructing the policy rules tree.
Errors
Returns PolicyValidator::Error
if any.
Auto Trait Implementations
impl<V, M, S> RefUnwindSafe for PolicyBuilder<V, M, S> where
M: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
[src]
M: RefUnwindSafe,
S: RefUnwindSafe,
V: RefUnwindSafe,
impl<V, M, S> Send for PolicyBuilder<V, M, S> where
M: Send,
S: Send,
V: Send,
[src]
M: Send,
S: Send,
V: Send,
impl<V, M, S> Sync for PolicyBuilder<V, M, S> where
M: Sync,
S: Sync,
V: Sync,
[src]
M: Sync,
S: Sync,
V: Sync,
impl<V, M, S> Unpin for PolicyBuilder<V, M, S> where
M: Unpin,
S: Unpin,
V: Unpin,
[src]
M: Unpin,
S: Unpin,
V: Unpin,
impl<V, M, S> UnwindSafe for PolicyBuilder<V, M, S> where
M: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
[src]
M: UnwindSafe,
S: UnwindSafe,
V: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,