pub enum Policy<S: Scope> {
Scope(S),
OneOf(Vec<Policy<S>>),
AllOf(Vec<Policy<S>>),
Not(Box<Policy<S>>),
AllowAll,
DenyAll,
}Expand description
A policy to verify a set of scopes
Policies can be combined using the &, | and ! operators :
let policy_a = MyScope::Foo.into_policy() & MyScope::Bar.into_policy();
let policy_b = (MyScope::Baz.into_policy() | MyScope::Bar.into_policy()) & !policy_a;You can also use a PolicyBuilder<S> to build
complex policies.
Variants§
Scope(S)
Requires a scope to be present
OneOf(Vec<Policy<S>>)
Requires one of the policies to be verified
AllOf(Vec<Policy<S>>)
Requires all of the policies to be verified
Not(Box<Policy<S>>)
Requires a policy not to be verified
AllowAll
Policy that always accept everything
DenyAll
Policy that accepts nothing
Implementations§
Source§impl<S: Scope> Policy<S>
impl<S: Scope> Policy<S>
Sourcepub fn builder() -> PolicyBuilder<S>
pub fn builder() -> PolicyBuilder<S>
Create a new PolicyBuilder<S>
Equivalent to calling PolicyBuilder<S>::new
Trait Implementations§
impl<S: Scope> StructuralPartialEq for Policy<S>
Auto Trait Implementations§
impl<S> Freeze for Policy<S>where
S: Freeze,
impl<S> RefUnwindSafe for Policy<S>where
S: RefUnwindSafe,
impl<S> Send for Policy<S>where
S: Send,
impl<S> Sync for Policy<S>where
S: Sync,
impl<S> Unpin for Policy<S>where
S: Unpin,
impl<S> UnwindSafe for Policy<S>where
S: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, I> IntoPolicy<S> for I
impl<S, I> IntoPolicy<S> for I
Source§fn into_policy(self) -> Policy<S>
fn into_policy(self) -> Policy<S>
Converts this type to a
Policy<S>