pub enum PolicyDecision {
Allow,
AllowWithGrant(Grant),
Deny {
reason: Option<String>,
},
AskUser,
}Expand description
Decision from a permission policy.
Variants§
Allow
Allow the request immediately.
AllowWithGrant(Grant)
Allow and grant permission for similar future requests.
The grant is stored and used to auto-approve matching requests.
Deny
Deny the request immediately.
AskUser
Defer to the consumer (show prompt to user).
This is the default for interactive frontends.
Implementations§
Source§impl PolicyDecision
impl PolicyDecision
Sourcepub fn allow() -> PolicyDecision
pub fn allow() -> PolicyDecision
Create an Allow decision.
Sourcepub fn allow_with_grant(grant: Grant) -> PolicyDecision
pub fn allow_with_grant(grant: Grant) -> PolicyDecision
Create an AllowWithGrant decision.
Sourcepub fn deny(reason: impl Into<String>) -> PolicyDecision
pub fn deny(reason: impl Into<String>) -> PolicyDecision
Create a Deny decision with a reason.
Sourcepub fn deny_silent() -> PolicyDecision
pub fn deny_silent() -> PolicyDecision
Create a Deny decision without a reason.
Sourcepub fn ask_user() -> PolicyDecision
pub fn ask_user() -> PolicyDecision
Create an AskUser decision.
Trait Implementations§
Source§impl Clone for PolicyDecision
impl Clone for PolicyDecision
Source§fn clone(&self) -> PolicyDecision
fn clone(&self) -> PolicyDecision
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PolicyDecision
impl RefUnwindSafe for PolicyDecision
impl Send for PolicyDecision
impl Sync for PolicyDecision
impl Unpin for PolicyDecision
impl UnwindSafe for PolicyDecision
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<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