pub struct PolicyDecision {
pub id: PolicyDecisionId,
pub kind: PolicyDecisionKind,
pub reason: String,
pub rule_id: Option<PolicyRuleId>,
pub metadata: Value,
pub trace: Option<DecisionTrace>,
}Expand description
The outcome of a policy evaluation
Fields§
§id: PolicyDecisionIdUnique ID for this decision (for audit trail)
kind: PolicyDecisionKindThe decision outcome
reason: StringHuman-readable explanation
rule_id: Option<PolicyRuleId>The rule that triggered this decision (if any)
metadata: ValueAdditional context
trace: Option<DecisionTrace>Audit-grade explanation of how this decision was reached: every
matched verdict, which one fired, and which were overridden by
precedence. None for legacy code paths that haven’t been wired
through the conflict resolver yet — additive on the wire.
Implementations§
Source§impl PolicyDecision
impl PolicyDecision
pub fn allow(reason: impl Into<String>) -> Self
pub fn deny(reason: impl Into<String>) -> Self
pub fn requires_approval(reason: impl Into<String>) -> Self
pub fn with_rule(self, rule_id: PolicyRuleId) -> Self
Sourcepub fn with_trace(self, trace: DecisionTrace) -> Self
pub fn with_trace(self, trace: DecisionTrace) -> Self
Attach an explanation trace produced by
crate::precedence::resolve_conflicts +
crate::trace::DecisionTrace::from_resolution.
pub fn is_allowed(&self) -> bool
pub fn is_denied(&self) -> bool
pub fn needs_approval(&self) -> bool
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 (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 PolicyDecision
impl Debug for PolicyDecision
Source§impl<'de> Deserialize<'de> for PolicyDecision
impl<'de> Deserialize<'de> for PolicyDecision
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for PolicyDecision
impl RefUnwindSafe for PolicyDecision
impl Send for PolicyDecision
impl Sync for PolicyDecision
impl Unpin for PolicyDecision
impl UnsafeUnpin 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