pub enum NoteValue {
Int(i64),
Uint(u64),
Float(f64),
Bool(bool),
Text(String),
}Expand description
Result of checking a scenario run.
Contains pass/fail status, human-readable detail messages, and
aggregated statistics. Multiple results can be combined with
merge().
let mut a = AssertResult::pass();
assert!(a.is_pass());
let mut b = AssertResult::pass();
b.record_fail(AssertDetail::new(DetailKind::Starved, "worker starved"));
a.merge(b);
assert!(a.is_fail());
assert!(a.failure_details().any(|d| d.kind == DetailKind::Starved));Structured measurement value attached via
AssertResult::note_value / Verdict::note_value.
The variants cover every primitive shape stats tooling consumes:
signed and unsigned 64-bit ints, 64-bit floats, booleans, and
owned strings. A test that wants to surface “max_wchar=12345”
alongside a passing IO_ACCOUNTING reachability check writes
verdict.note_value("max_wchar", 12345i64) and downstream stats
tooling reads result.measurements["max_wchar"] as
NoteValue::Int(12345).
Distinct from AssertResult::info_notes’s free-form
InfoNote messages: an InfoNote carries a single human-
readable string (formatted via its Display impl), the
structured map carries typed (key, NoteValue) pairs for
programmatic consumption (sidecar parsers, perf-delta,
regression dashboards). Producers can call BOTH note(msg)
and note_value(key, val) on the same result — they occupy
independent buffers (info_notes vs measurements).
Conversion via the From impls below: any
i64/u64/f64/bool/String/&str literal flows into
note_value without explicit variant naming. Integer types
narrower than 64-bit (i32, u32, etc.) need an explicit cast
at the call site rather than a blanket impl, so the call site
reads honestly about the value’s resolution.
Derives PartialEq but NOT Eq: the Float(f64) variant holds
IEEE-754 doubles where NaN != NaN, which violates the
reflexivity requirement on Eq. Equality on NoteValue is
partial-equivalence semantics for the same reason f64 is.
Uses serde’s externally-tagged default (no #[serde(untagged)]).
Like Outcome, NoteValue is wire-encoded as part of
AssertResult::measurements via postcard’s TLV transport from
guest to host. Postcard is not a self-describing format and cannot
decode #[serde(untagged)] enums (returns WontImplement) — pre-fix
the decode silently failed when any test populated measurements
before its result crossed the wire. The externally-tagged default
(JSON form {"Int": 42} / {"Text": "x"}) is what postcard’s
externally-tagged enum decoder expects. The
assert_result_postcard_roundtrip test pins this contract so a
regression that re-adds #[serde(untagged)] trips at test time
rather than as a silent data drop at runtime.
Variants§
Int(i64)
64-bit signed integer — pid_t, exit codes, signed counters.
Uint(u64)
64-bit unsigned integer — work_units, byte counts, durations.
Float(f64)
64-bit float — ratios, rates, percentiles in microseconds.
Bool(bool)
Boolean — completion flags, feature-detect results.
Text(String)
Owned string — categorical labels, environment tokens.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NoteValue
impl<'de> Deserialize<'de> for NoteValue
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>,
impl StructuralPartialEq for NoteValue
Auto Trait Implementations§
impl Freeze for NoteValue
impl RefUnwindSafe for NoteValue
impl Send for NoteValue
impl Sync for NoteValue
impl Unpin for NoteValue
impl UnwindSafe for NoteValue
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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