pub enum Verdict {
Allow,
Deny {
reason: String,
guard: String,
http_status: u16,
details: Box<DenyDetails>,
},
Cancel {
reason: String,
},
Incomplete {
reason: String,
},
}Expand description
The verdict for an HTTP request evaluation.
Consistent with chio_core_types::Decision but carries HTTP-specific context.
Variants§
Allow
Request is allowed. Proceed to upstream.
Deny
Request is denied. Return a structured error response.
Fields
details: Box<DenyDetails>Structured deny context: tool identity, required vs granted
scope, a stable reason code, receipt id, and a next-steps
hint. All fields are optional and default to None, so this
field is transparent to wire clients that ignore deny details.
Boxed to keep the Verdict enum compact on the hot allow
path; the structured deny context is only populated on the
(comparatively rare) deny path.
Cancel
Request evaluation was cancelled (e.g., timeout, circuit breaker).
Incomplete
Request evaluation did not reach a terminal state.
Implementations§
Source§impl Verdict
impl Verdict
Sourcepub fn deny(reason: impl Into<String>, guard: impl Into<String>) -> Self
pub fn deny(reason: impl Into<String>, guard: impl Into<String>) -> Self
Deny with a 403 status.
Sourcepub fn deny_with_status(
reason: impl Into<String>,
guard: impl Into<String>,
http_status: u16,
) -> Self
pub fn deny_with_status( reason: impl Into<String>, guard: impl Into<String>, http_status: u16, ) -> Self
Deny with a custom HTTP status code.
Sourcepub fn deny_detailed(
reason: impl Into<String>,
guard: impl Into<String>,
details: DenyDetails,
) -> Self
pub fn deny_detailed( reason: impl Into<String>, guard: impl Into<String>, details: DenyDetails, ) -> Self
Deny with a full structured context block.
Prefer this constructor when the kernel already knows what scope was needed versus granted, which guard fired, and a hint for the developer. The HTTP status defaults to 403.
Sourcepub fn with_deny_details(self, new_details: DenyDetails) -> Self
pub fn with_deny_details(self, new_details: DenyDetails) -> Self
Attach (or overwrite) the structured deny context on an existing
Deny verdict. No-op for non-Deny variants. Useful when the
guard pipeline constructs a plain deny and a later enrichment
stage populates the details.
pub fn is_allowed(&self) -> bool
pub fn is_denied(&self) -> bool
Sourcepub fn to_decision(&self) -> Decision
pub fn to_decision(&self) -> Decision
Convert to the core Decision type for receipt signing.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Verdict
impl<'de> Deserialize<'de> for Verdict
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 Verdict
impl StructuralPartialEq for Verdict
Auto Trait Implementations§
impl Freeze for Verdict
impl RefUnwindSafe for Verdict
impl Send for Verdict
impl Sync for Verdict
impl Unpin for Verdict
impl UnsafeUnpin for Verdict
impl UnwindSafe for Verdict
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.