pub enum PolicyOutcome {
Findings(Vec<PolicyFinding>),
Unavailable(&'static str),
Failed {
code: EngineFailureCode,
message: String,
path: Option<EventPath>,
},
}Expand description
What:
What one policy check returned.
An enum is a closed set of named alternatives;
Failed { code, message } carries named fields.
Why:
“Nothing found”,
“cannot be evaluated here” and “could not finish” are three
different answers;
folding the last two into an empty finding list would let an
unchecked command through.
A policy that could not finish names its cause:
content-unavailable when candidate bytes or a repository fact could not be
read,
policy-incomplete when its own machinery failed.
In TS you’d write (pseudocode):
type PolicyOutcome = { kind: 'findings'; findings: PolicyFinding[] } | { kind: 'unavailable'; needs: string } | { kind: 'failed'; code: EngineFailureCode; message: string; path?: EventPath };Variants§
Findings(Vec<PolicyFinding>)
The policy was evaluated; an empty list means it found nothing.
The policy needs something this executable does not implement yet; the text names it.
Failed
The policy could not finish.
Fields
code: EngineFailureCodeThe cause, as the engine-failure event reports it.
Trait Implementations§
Source§impl Clone for PolicyOutcome
impl Clone for PolicyOutcome
Source§impl Debug for PolicyOutcome
impl Debug for PolicyOutcome
impl Eq for PolicyOutcome
Source§impl PartialEq for PolicyOutcome
impl PartialEq for PolicyOutcome
impl StructuralPartialEq for PolicyOutcome
Auto Trait Implementations§
impl Freeze for PolicyOutcome
impl RefUnwindSafe for PolicyOutcome
impl Send for PolicyOutcome
impl Sync for PolicyOutcome
impl Unpin for PolicyOutcome
impl UnsafeUnpin for PolicyOutcome
impl UnwindSafe for PolicyOutcome
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more