Verdict

Struct Verdict 

Source
pub struct Verdict { /* private fields */ }
Expand description

Pointwise-claim accumulator.

Carries an AssertResult under the hood and exposes the same outcome() / outcomes / stats shape on completion. Build via Verdict::new or Assert::verdict; finish with Verdict::into_result.

// Empty verdict — no claims, passes.
let v = Assert::default_checks().verdict();
let r = v.into_result();
assert!(r.is_pass());

Implementations§

Source§

impl Verdict

Source

pub fn new() -> Self

Empty accumulator with no Assert attached. Use when a test is composing pointwise claims and does not care about the scheduler-level threshold layer.

Source

pub fn with_assert(assert: Assert) -> Self

Empty accumulator carrying assert for downstream lookup. Reached via Assert::verdict; not part of the test author’s usual entry point.

Source

pub fn with_log_passes(self, on: bool) -> Self

Toggle positive-confirmation logging. When on, every comparator’s pass arm emits a tracing::info! event naming the claim and the values compared, visible to operators running tests with --nocapture. Off by default — the pass path stays allocation-free.

Initial value reads KTSTR_LOG_PASSES (any value other than "" or "0" enables) so a debugging session can flip the flag from the shell without touching test source. Programmatic override always wins over the env var; chain .with_log_passes(false) to silence a single verdict even when the env var is set.

Source

pub fn log_passes(&self) -> bool

Read the current positive-confirmation logging flag.

Source

pub fn note(&mut self, msg: impl Into<String>) -> &mut Self

Append an informational note to the underlying AssertResult without altering the verdict. Mirrors AssertResult::note.

Source

pub fn note_value( &mut self, key: impl Into<String>, value: impl Into<NoteValue>, ) -> &mut Self

Attach a structured (key, value) measurement to the underlying AssertResult::measurements map without altering the verdict. Mirrors AssertResult::note_value. Use when a test wants to surface a programmatically consumable measurement (e.g. verdict.note_value("max_wchar", 12345i64)) alongside pass/fail claims, so sidecar parsers and stats compare dashboards can read the typed value without re-grepping details.

Source

pub fn skip(&mut self, reason: impl Into<String>) -> &mut Self

Mark the verdict as skipped with the supplied reason. Pushes one Outcome::Skip carrying a DetailKind::Skip detail onto the outcome stream. Use when a precondition is missing and the scenario cannot run.

Prior outcomes are preserved: a verdict whose earlier claim failed and then transitions to skip stays failed. The merge lattice (Fail > Inconclusive > Pass > Skip) keeps any recorded Outcome::Fail dominant, so once a claim records a real failure, a later skip cannot mask it. Distinct from AssertResult::skip, which is a CONSTRUCTOR producing a fresh skipped envelope from no prior state.

Source

pub fn skip_if(&mut self, cond: bool, reason: impl Into<String>) -> &mut Self

Conditional skip: skip with reason when cond is true; no-op otherwise. Convenience over if cond { v.skip(reason); }.

Source

pub fn inconclusive(&mut self, detail: AssertDetail) -> &mut Self

Mark the verdict as inconclusive with the supplied detail. Pushes one Outcome::Inconclusive carrying detail onto the outcome stream. Use when the gate APPLIED (preconditions were met) but the signal needed to evaluate it was absent — e.g. a ratio whose denominator is INSTRUMENT-derived and happened to be zero (no migrations observed), so the comparison cannot be performed and the verdict is neither pass nor fail.

Boundary with Self::skip: Inconclusive = the gate applied but the signal was absent; Skip = the gate’s precondition was unmet so the gate did not apply at all. Boundary with comparator-driven record_fail: Inconclusive = the denominator is INSTRUMENT-derived (a measurement that happened to be zero); Fail = the denominator is POLICY-derived (a configured expectation that must hold — see the Outcome doc’s MemPolicy::Bind carve-out).

Prior outcomes are preserved: a verdict whose earlier claim failed and then transitions to inconclusive stays failed per the merge lattice (Fail > Inconclusive > Pass > Skip).

Source

pub fn inconclusive_if(&mut self, cond: bool, detail: AssertDetail) -> &mut Self

Conditional inconclusive: record detail when cond is true; no-op otherwise. Convenience over if cond { v.inconclusive(detail); }. Mirrors Self::skip_if.

Source

pub fn merge(&mut self, other: AssertResult) -> &mut Self

Fold an external AssertResult into this verdict. Useful when a test combines pointwise claims with the result of an upstream assert_* call (e.g. assert_not_starved). Mirrors AssertResult::merge semantics — other.outcomes are appended to this verdict’s outcome stream, so the merge lattice (Fail > Inconclusive > Pass > Skip) folds across both sides; notes/measurements are concatenated; aggregate stats adopt the worst per dimension.

Source

pub fn is_pass(&self) -> bool

True iff the folded outcome is Outcome::Pass. Per AssertResult::is_pass, this requires no recorded Fail, no recorded Inconclusive, AND the outcome stream is either empty or contains at least one non-Skip claim. An empty verdict (no claims recorded) folds to Pass; an all-Skip stream returns false here — the verdict didn’t fail, but it also didn’t actually run. Read-only. Name matches the rest of the 4-state vocabulary across AssertResult::is_pass / crate::test_support::SidecarResult::is_pass / Outcome::is_pass / Self::is_pass / MonitorVerdict::is_pass (in the monitor module, which is pub(crate)) / GauntletRow::is_pass (in the stats module, which is pub(crate)). The methods are pub; only the containing modules are pub(crate), so the bare rustdoc links don’t resolve from this pub item — the code spans on those two are bare to avoid a private intra-doc-link warning.

Note: a verdict that recorded one or more Outcome::Inconclusive outcomes returns false here even though it did not record a hard failure. Use Verdict::into_result + AssertResult::outcome when callers need to distinguish Pass from Inconclusive from Fail.

Source

pub fn is_fail(&self) -> bool

True iff any recorded outcome is Outcome::Fail. Mirrors AssertResult::is_fail — any Fail in the outcome stream dominates under the Fail > Inconclusive > Pass > Skip lattice, so a single failed claim makes this true regardless of how many later inconclusive or pass claims followed.

Source

pub fn is_inconclusive(&self) -> bool

True iff any recorded outcome is Outcome::Inconclusive and no Outcome::Fail was recorded. Mirrors AssertResult::is_inconclusive. Fail dominates: a verdict with both Fail and Inconclusive outcomes returns false here and true from Self::is_fail.

Source

pub fn is_skip(&self) -> bool

True iff the outcome stream is non-empty and every recorded outcome is Outcome::Skip. Mirrors AssertResult::is_skip. An empty verdict (the merge identity) returns false here — it is reported as Pass via Self::is_pass, not Skip.

Source

pub fn detail_count(&self) -> usize

Number of recorded outcomes carrying a payload (Fail + Inconclusive + Skip) — i.e. recorded diagnostics so far. Pass markers don’t count.

Source

pub fn assert(&self) -> Option<&Assert>

Read the Assert threshold config attached at construction time, if any. None when the verdict was built via Verdict::new (no threshold layer).

Source

pub fn into_result(self) -> AssertResult

Consume the accumulator and return the merged AssertResult. Terminal — chain .into_result() at the end of a fluent claim sequence to feed the result into the test return value.

Source

pub fn into_anyhow_or_log(self) -> Result<()>

Terminal post_vm-callback helper. Equivalent to self.into_result().into_anyhow_or_log() — drains the accumulator, logs every crate::assert::InfoNote via tracing::info!, and bails on any accumulated failure (with all failure details concatenated). See AssertResult::into_anyhow_or_log for the full contract.

Use this to collapse a typical post_vm callback’s terminal let r = v.into_result(); … bail/log loop boilerplate into a single chainable call.

Trait Implementations§

Source§

impl Clone for Verdict

Source§

fn clone(&self) -> Verdict

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Verdict

Source§

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

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

impl Default for Verdict

Source§

fn default() -> Self

Equivalent to Verdict::new: no threshold config attached, no claims accumulated.

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSend for T
where T: Send,