Skip to main content

GateOutcomes

Struct GateOutcomes 

Source
pub struct GateOutcomes(/* private fields */);
Expand description

The verdict of every gate a run evaluated, keyed by name.

A gate is armed by a flag or by config. The default exit rule of a command is always in the object, also when no flag armed a gate: error-severity-findings on dead-code, check and the combined run (with health-findings when the combined run analyzed health), health-findings on health, security-advisory on security and audit-verdict on audit. A reader of the JSON sees a failing run without the exit code. dupes has no default exit rule, so a dupes run that armed no gate carries no object and always exits 0.

An empty object is never emitted. The typed programmatic API runs no CLI gate and leaves the object absent.

The names this build can emit are error-severity-findings, regression, stale-baseline, duplication-threshold, health-min-score, health-min-severity, health-findings, health-coverage-gaps, health-runtime-coverage, security, security-advisory, audit-verdict, type-aware-require and parse-error. The set is OPEN: a name a consumer does not recognise means “some gate”, not an error.

Implementations§

Source§

impl GateOutcomes

Source

pub fn new() -> Self

An empty set, which serializes to nothing once Self::into_option has been applied.

Source

pub fn insert(&mut self, name: GateName, outcome: GateOutcome)

Record one gate’s outcome, replacing any previous entry for that name.

Source

pub fn insert_if(&mut self, name: GateName, outcome: Option<GateOutcome>)

Record one gate’s outcome when it ran at all.

Source

pub fn get(&self, name: GateName) -> Option<&GateOutcome>

Read one gate’s outcome.

Source

pub fn fails_run(&self) -> bool

Whether a gate of the set fails the run: its status is fail and it is enforced.

Source

pub fn is_empty(&self) -> bool

Whether the set holds no gate.

Source

pub fn into_option(self) -> Option<Self>

Collapse an empty set to None, which is how the field stays absent on a run that evaluated no gate.

Trait Implementations§

Source§

impl Clone for GateOutcomes

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GateOutcomes

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for GateOutcomes

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for GateOutcomes

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for GateOutcomes

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for GateOutcomes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<'a, T> FromIn<'a, T> for T

Source§

fn from_in(t: T, _: &'a Allocator) -> T

Converts to this type from the input type within the given allocator.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<'a, T, U> IntoIn<'a, U> for T
where U: FromIn<'a, T>,

Source§

fn into_in(self, allocator: &'a Allocator) -> U

Converts this type into the (usually inferred) input type within the given allocator.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more