pub enum Predicate {
Evaluator(EvaluatorId, CompiledId),
Unusable {
reason: String,
},
}Expand description
What decides this policy’s outcome, once its applicability is already established.
Split from Applicability deliberately, because the two fail
differently and only one of the failures is a policy’s failure.
Applicability is simple declarative data — collections, path
prefixes, kinds, actions — that the core itself validates at the
boundary, never something an engine interprets. A record whose
applicability does not parse is therefore not a malformed policy; it is
a malformed record that never becomes a PolicyDeclaration at all.
It enforces nothing, it is surfaced to the operator, and nothing about
it is represented anywhere in this crate’s types — there is no third
state here for it, and there should not be one.
What is real, because a PolicyDeclaration can still hold it: the
predicate — a regular expression, a hand-rolled matcher, anything an
engine actually interprets — fails to parse or load, while its already
known-good applicability says exactly what the policy covers. That
failure can be scoped the same way an unavailable evaluator’s is,
denying only the writes it would have judged rather than everything or
nothing. Unusable is that state, named rather than
left implicit, because a reader needs to tell “this policy denies
things because it is broken” apart from “this policy denies things
because it says so.”
Variants§
Evaluator(EvaluatorId, CompiledId)
Applicability and predicate both parsed and compiled; this
evaluator judges it, consulting the artifact named by CompiledId
– see CompiledId’s doc comment for why that, not PolicyId,
is what an evaluator is handed back at decision time.
Unusable
Applicability parsed; the predicate did not. Denies every subject
within this policy’s applicability — fail-closed, scoped by the
tree exactly like an EvalError from
a live evaluator, because from the tree’s perspective the two are
the same event at different times: a predicate that cannot be
asked.
Trait Implementations§
impl Eq for Predicate
impl StructuralPartialEq for Predicate
Auto Trait Implementations§
impl Freeze for Predicate
impl RefUnwindSafe for Predicate
impl Send for Predicate
impl Sync for Predicate
impl Unpin for Predicate
impl UnsafeUnpin for Predicate
impl UnwindSafe for Predicate
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.