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.
For a leaf error or variant you define, prefer encoding its intrinsic classification in its
source() implementation. The associated constants, such as Self::NOT_FOUND,
are owned class-only markers: return Some(const { &ClassificationMarker::NOT_FOUND }) without defining a static.
This classifies every construction site without repeated tagging.
Self::with_class() creates an owned class-only marker.
Use crate::tag() for classifications that depend on the calling context or for error types you cannot modify,
preserving the concrete type and diagnostic.
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 PERMISSION_DENIED: Self
pub const PERMISSION_DENIED: Self
Authorization or permissions are insufficient; obtain authorization or change permissions.
Sourcepub const UNAUTHENTICATED: Self
pub const UNAUTHENTICATED: Self
Credentials are missing or rejected; obtain or refresh credentials.
Sourcepub const CONFLICT: Self
pub const CONFLICT: Self
Current state conflicts with the operation; refresh or reconcile state before retrying.
Sourcepub const UNSUPPORTED: Self
pub const UNSUPPORTED: Self
A required capability is unsupported; switch implementation, format, protocol, or strategy.
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()
Auto Trait Implementations§
impl !RefUnwindSafe for ClassificationMarker
impl !UnwindSafe for ClassificationMarker
impl Freeze for ClassificationMarker
impl Send for ClassificationMarker
impl Sync for ClassificationMarker
impl Unpin for ClassificationMarker
impl UnsafeUnpin for ClassificationMarker
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> ErrorExt for T
impl<T> ErrorExt for T
Source§fn raise_typed(self) -> Exn<Self>where
Self: Sized,
fn raise_typed(self) -> Exn<Self>where
Self: Sized,
Self even when it is already an Error.Source§fn and_raise_typed<T: Error + Send + Sync + 'static>(self, context: T) -> Exn<T>where
Self: Sized,
fn and_raise_typed<T: Error + Send + Sync + 'static>(self, context: T) -> Exn<T>where
Self: Sized,
Self::and_raise(), retaining the context’s type in an exception.Source§fn raise_erased(self) -> Exnwhere
Self: Sized,
fn raise_erased(self) -> Exnwhere
Self: Sized,
crate::Error values reuse their existing frame and caller location.