pub struct AssertDetail {
pub kind: DetailKind,
pub message: String,
pub phase: Option<Cow<'static, str>>,
}Expand description
A single diagnostic message from an assertion, paired with a
structural DetailKind so filtering is robust to wording changes.
Access the message text via detail.message; format-string probes
(format!("{detail}")) work via the Display impl. New code that
needs to filter by category should match on kind rather than
substring-match the message text — wording can change without
notice but the variant tag is the structural contract.
Fields§
§kind: DetailKind§message: String§phase: Option<Cow<'static, str>>Scenario phase the detail was emitted under. Mirrors
PassDetail::phase: None outside any PhaseGuard scope
(boot, BASELINE settle, non-scenario test fixtures), Some
when an active guard has installed a label. Carried on every
detail so consumers (auto-repro renderer, sidecar parsers)
see a uniform phase field across pass + fail records.
Producers that already know the active phase can stamp via
Self::with_phase.
Cow<'static, str> mirrors PassDetail::phase for the
same zero-allocation reason: the common case is the per-step
RAII guard’s static &'static str label staying as
Cow::Borrowed (zero alloc); runtime-built Strings become
Cow::Owned.
Implementations§
Source§impl AssertDetail
impl AssertDetail
pub fn new(kind: DetailKind, message: impl Into<String>) -> Self
Sourcepub fn with_phase(self, phase: impl Into<Cow<'static, str>>) -> Self
pub fn with_phase(self, phase: impl Into<Cow<'static, str>>) -> Self
Builder-style setter for Self::phase. Consumes self,
stamps the phase label, returns the updated value. Matches
the PassDetail::with_phase shape so producers can chain
AssertDetail::new(...).with_phase(...) uniformly across
pass and fail records.
Sourcepub fn display_with_kind(&self) -> AssertDetailWithKind<'_>
pub fn display_with_kind(&self) -> AssertDetailWithKind<'_>
Borrow this detail as a kind-prefixed std::fmt::Display
adapter. The default Display impl on
AssertDetail writes only message so terminal output reads
as bare prose; structured-log consumers that want to bucket
failures by category without re-checking Self::kind reach
for this helper instead.
Renders as [<DetailKind variant name>] <message> — debug-form
for the kind so the variant token is grep-stable across renames
(a regression that drops a DetailKind variant breaks the
match arms that produce it; the rendered token follows). Zero-
allocation: the wrapper holds a &AssertDetail and writes
straight into the formatter.
let d = AssertDetail::new(DetailKind::Stuck, "tid 7 stuck 1500ms on cpu3");
assert_eq!(d.to_string(), "tid 7 stuck 1500ms on cpu3");
assert_eq!(
d.display_with_kind().to_string(),
"[Stuck] tid 7 stuck 1500ms on cpu3",
);Trait Implementations§
Source§impl Clone for AssertDetail
impl Clone for AssertDetail
Source§fn clone(&self) -> AssertDetail
fn clone(&self) -> AssertDetail
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AssertDetail
impl Debug for AssertDetail
Source§impl<'de> Deserialize<'de> for AssertDetail
impl<'de> Deserialize<'de> for AssertDetail
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>,
Source§impl Display for AssertDetail
impl Display for AssertDetail
Source§impl From<&str> for AssertDetail
impl From<&str> for AssertDetail
Source§fn from(s: &str) -> Self
fn from(s: &str) -> Self
Conversion for uncategorized messages; defaults kind to
DetailKind::Other. Prefer AssertDetail::new when the
detail has a meaningful category — the DetailKind is serialized
into the sidecar JSON and consumed by stats tooling to bucket
failures, so losing the category bucket makes post-run
categorization rely on free-text regex against message.
Source§impl From<String> for AssertDetail
impl From<String> for AssertDetail
Source§fn from(message: String) -> Self
fn from(message: String) -> Self
Conversion for uncategorized messages; defaults kind to
DetailKind::Other. Prefer AssertDetail::new when the
detail has a meaningful category — the DetailKind is serialized
into the sidecar JSON and consumed by stats tooling to bucket
failures, so losing the category bucket makes post-run
categorization rely on free-text regex against message.
Source§impl PartialEq for AssertDetail
impl PartialEq for AssertDetail
Source§impl Serialize for AssertDetail
impl Serialize for AssertDetail
impl Eq for AssertDetail
impl StructuralPartialEq for AssertDetail
Auto Trait Implementations§
impl Freeze for AssertDetail
impl RefUnwindSafe for AssertDetail
impl Send for AssertDetail
impl Sync for AssertDetail
impl Unpin for AssertDetail
impl UnwindSafe for AssertDetail
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.§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
§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