#[non_exhaustive]pub enum BatchDecision {
Allowed(Vec<Decision>),
Denied {
index: usize,
denial: Denial,
},
ShadowDenied {
index: usize,
denial: Denial,
},
}Expand description
The atomic outcome of evaluating checks in caller-supplied order.
An allowed batch contains one allowed decision for each input check, in the
same order. A denied batch reports the original input index that failed.
Backends must not consume any check when returning BatchDecision::Denied.
With the serde feature, this is an object tagged by outcome.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Allowed(Vec<Decision>)
Every input check was allowed.
Denied
One input check caused the whole batch to be denied.
Fields
ShadowDenied
Quota was exceeded for one shadow policy, so nothing was consumed but the application may proceed.
Implementations§
Source§impl BatchDecision
impl BatchDecision
Sourcepub const fn permits_request(&self) -> bool
pub const fn permits_request(&self) -> bool
Returns whether the application may proceed.
Sourcepub const fn would_deny(&self) -> bool
pub const fn would_deny(&self) -> bool
Returns whether evaluation encountered quota or capacity denial.
Sourcepub const fn is_enforced_denial(&self) -> bool
pub const fn is_enforced_denial(&self) -> bool
Returns whether the application must reject the operation.
Sourcepub const fn is_shadow_denied(&self) -> bool
pub const fn is_shadow_denied(&self) -> bool
Returns whether quota was exceeded in shadow mode.
Sourcepub fn try_into_single_decision(self) -> Result<Decision, Self>
pub fn try_into_single_decision(self) -> Result<Decision, Self>
Converts a batch-of-one outcome into its single-check decision.
Returns the original batch when an allowed result does not contain exactly one allowed decision or a denied result names an index other than zero.
§Errors
Returns the unchanged batch when it is not a valid batch-of-one result.
Trait Implementations§
Source§impl Clone for BatchDecision
impl Clone for BatchDecision
Source§fn clone(&self) -> BatchDecision
fn clone(&self) -> BatchDecision
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BatchDecision
impl Debug for BatchDecision
Source§impl<'de> Deserialize<'de> for BatchDecision
Available on crate feature serde only.
impl<'de> Deserialize<'de> for BatchDecision
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for BatchDecision
Source§impl PartialEq for BatchDecision
impl PartialEq for BatchDecision
Source§impl Serialize for BatchDecision
Available on crate feature serde only.
impl Serialize for BatchDecision
serde only.