pub enum GateDecision {
Allow {
obligations: Vec<Obligation>,
},
Deny {
reason: String,
},
}Expand description
Gate decision: allow (with optional obligations) or deny (with reason).
Deny requires a non-empty reason. Enforced at construction and
deserialization.
Variants§
Implementations§
Source§impl GateDecision
impl GateDecision
Sourcepub fn allow() -> GateDecision
pub fn allow() -> GateDecision
Returns an unconditional Allow with no obligations.
Sourcepub fn allow_with(obligations: Vec<Obligation>) -> GateDecision
pub fn allow_with(obligations: Vec<Obligation>) -> GateDecision
Returns an Allow with the given policy obligations attached.
Sourcepub fn try_deny(
reason: impl Into<String>,
) -> Result<GateDecision, GateValidationError>
pub fn try_deny( reason: impl Into<String>, ) -> Result<GateDecision, GateValidationError>
Create a Deny decision. Returns Err if reason is empty.
Sourcepub fn deny(reason: impl Into<String>) -> GateDecision
pub fn deny(reason: impl Into<String>) -> GateDecision
Returns a Deny with the given reason. Panics if reason is empty.
Trait Implementations§
Source§impl Clone for GateDecision
impl Clone for GateDecision
Source§fn clone(&self) -> GateDecision
fn clone(&self) -> GateDecision
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GateDecision
impl Debug for GateDecision
Source§impl<'de> Deserialize<'de> for GateDecision
impl<'de> Deserialize<'de> for GateDecision
Source§fn deserialize<D>(
deserializer: D,
) -> Result<GateDecision, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<GateDecision, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for GateDecision
impl Serialize for GateDecision
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl TryFrom<RawGateDecision> for GateDecision
impl TryFrom<RawGateDecision> for GateDecision
Source§type Error = GateValidationError
type Error = GateValidationError
The type returned in the event of a conversion error.
Source§fn try_from(
raw: RawGateDecision,
) -> Result<GateDecision, <GateDecision as TryFrom<RawGateDecision>>::Error>
fn try_from( raw: RawGateDecision, ) -> Result<GateDecision, <GateDecision as TryFrom<RawGateDecision>>::Error>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for GateDecision
impl RefUnwindSafe for GateDecision
impl Send for GateDecision
impl Sync for GateDecision
impl Unpin for GateDecision
impl UnsafeUnpin for GateDecision
impl UnwindSafe for GateDecision
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