pub struct ClassificationMarker { /* private fields */ }Expand description
A transparent classification marker with an optional owned source and no diagnostic of its own.
Unlike Message, markers only supply classification metadata, never a visible
diagnostic. Use Message to combine a message, class, and scalar values in one causal error;
use a marker to classify an existing concrete error without changing its diagnostic or recovery payload.
Self::with_source() adds a classification to an existing error while preserving its concrete type and diagnostic.
The associated constants, such as Self::NOT_FOUND, are owned class-only markers. A custom error can return
Some(const { &ClassificationMarker::NOT_FOUND }) from its source()
implementation without defining a static.
Self::with_class() creates an owned class-only marker, including for Class::Io with a specific I/O kind.
Diagnostic iterators, downcasts, cause selection, and exception/test reports skip all markers,
retaining their real descendants. crate::classify() still inspects markers. Raw standard-error sources can still
expose markers. A report with only class-only markers falls back to displaying the root classification.
If cause selection cannot choose a unique real descendant, it can likewise fall back to the stored marker root.
Preserve real std::io::Error sources: the marker itself has no I/O origin for crate::types::Classification::io_kind().
Implementations§
Source§impl ClassificationMarker
impl ClassificationMarker
Sourcepub const VALIDATION: Self
pub const VALIDATION: Self
A hidden marker for invalid input.
Sourcepub const CORRUPTION: Self
pub const CORRUPTION: Self
A hidden marker for malformed or internally inconsistent data.
Sourcepub const ALLOCATION_LIMIT: Self
pub const ALLOCATION_LIMIT: Self
A hidden marker for an application-configured allocation limit being exceeded.
Sourcepub const ALLOCATION_FAILURE: Self
pub const ALLOCATION_FAILURE: Self
A hidden marker for an unrepresentable allocation size or memory that could not be reserved.
Sourcepub fn with_source(
class: Class,
source: impl Error + Send + Sync + 'static,
) -> Self
pub fn with_source( class: Class, source: impl Error + Send + Sync + 'static, ) -> Self
Add class to source, preserving its concrete type and diagnostic without a visible wrapper.
Sourcepub const fn with_class(class: Class) -> Self
pub const fn with_class(class: Class) -> Self
Create a hidden metadata leaf, suitable for a custom error’s static source.
Prefer the associated constants, such as Self::NOT_FOUND, for fixed classifications.
Trait Implementations§
Source§impl Debug for ClassificationMarker
impl Debug for ClassificationMarker
Source§impl Display for ClassificationMarker
impl Display for ClassificationMarker
Source§impl Error for ClassificationMarker
impl Error for ClassificationMarker
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()