pub struct Diagnostic<K> { /* private fields */ }Available on crate feature
alloc only.Expand description
An envelope that collects detailed diagnostic information.
The backtrace will only be collected if the backtrace feature is enabled,
and either RUST_BACKTRACE or RUST_LIB_BACKTRACE are set.
§Collects
- backtrace (if enabled)
- context
- description
- error kind
- locations
§When To Use
When you are debugging an issue with your crate, or you want to allow a dependant to debug an issue with your crate.
§Example Display
When printed normally ("{error}"):
static error code: detailed dynamic error message
with context
├─ we found that a (12) is not b (34)
╰─ while working in my_procedure (a: 12, b: 34)When printed in alternate form ("{error:#}"):
static error code: detailed dynamic error message
at my-crate/src/main.rs:25:16
with context
├─ we found that a (12) is not b (34)
│ at my-crate/src/main.rs:25:16
╰─ while working in my_procedure (a: 12, b: 34)
at my-crate/src/main.rs:22:1Trait Implementations§
Source§impl<K: Clone> Clone for Diagnostic<K>
impl<K: Clone> Clone for Diagnostic<K>
Source§impl<K: Debug> Debug for Diagnostic<K>
impl<K: Debug> Debug for Diagnostic<K>
Source§impl<K: ErrorKind> Display for Diagnostic<K>
impl<K: ErrorKind> Display for Diagnostic<K>
impl<K: Eq> Eq for Diagnostic<K>
Source§impl<K: ErrorKind> ErrorContext for Diagnostic<K>
impl<K: ErrorKind> ErrorContext for Diagnostic<K>
Source§impl<K: ErrorKind> ErrorEnvelope for Diagnostic<K>
impl<K: ErrorKind> ErrorEnvelope for Diagnostic<K>
Source§type Envelope<T: ErrorKind> = Diagnostic<T>
type Envelope<T: ErrorKind> = Diagnostic<T>
How to map one
ErrorKind to another within this envelope.Source§fn convert<T>(self) -> Self::Envelope<T>
fn convert<T>(self) -> Self::Envelope<T>
Converts the underlying error kind into a compatible error kind.
Source§fn error_kind(&self) -> Self::Kind
fn error_kind(&self) -> Self::Kind
The error kind held within this envelope.
Source§fn with_description<S>(kind: Self::Kind, description: S) -> Selfwhere
S: StaticString,
fn with_description<S>(kind: Self::Kind, description: S) -> Selfwhere
S: StaticString,
Constructs a new envelope with the provided
error_kind and description.Source§impl<K: ErrorKind> From<Diagnostic<K>> for Described<K>
impl<K: ErrorKind> From<Diagnostic<K>> for Described<K>
Source§fn from(orig: Diagnostic<K>) -> Self
fn from(orig: Diagnostic<K>) -> Self
Converts to this type from the input type.
Source§impl<K: ErrorKind> From<Diagnostic<K>> for Located<K>
impl<K: ErrorKind> From<Diagnostic<K>> for Located<K>
Source§fn from(orig: Diagnostic<K>) -> Self
fn from(orig: Diagnostic<K>) -> Self
Converts to this type from the input type.
Source§impl<K: ErrorKind> From<K> for Diagnostic<K>
impl<K: ErrorKind> From<K> for Diagnostic<K>
Source§impl<K: Hash> Hash for Diagnostic<K>
impl<K: Hash> Hash for Diagnostic<K>
Source§impl<K: Ord> Ord for Diagnostic<K>
impl<K: Ord> Ord for Diagnostic<K>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl<K: PartialEq> PartialEq for Diagnostic<K>
impl<K: PartialEq> PartialEq for Diagnostic<K>
Source§impl<K: PartialEq> PartialEq<K> for Diagnostic<K>
impl<K: PartialEq> PartialEq<K> for Diagnostic<K>
Source§impl<K: PartialOrd> PartialOrd for Diagnostic<K>
impl<K: PartialOrd> PartialOrd for Diagnostic<K>
Source§impl<K: PartialOrd> PartialOrd<Described<K>> for Diagnostic<K>
impl<K: PartialOrd> PartialOrd<Described<K>> for Diagnostic<K>
Source§impl<K: PartialOrd> PartialOrd<Diagnostic<K>> for Described<K>
impl<K: PartialOrd> PartialOrd<Diagnostic<K>> for Described<K>
Source§impl<K: PartialOrd> PartialOrd<Diagnostic<K>> for Located<K>
impl<K: PartialOrd> PartialOrd<Diagnostic<K>> for Located<K>
Source§impl<K: PartialOrd> PartialOrd<K> for Diagnostic<K>
impl<K: PartialOrd> PartialOrd<K> for Diagnostic<K>
Source§impl<K: PartialOrd> PartialOrd<Located<K>> for Diagnostic<K>
impl<K: PartialOrd> PartialOrd<Located<K>> for Diagnostic<K>
Auto Trait Implementations§
impl<K> !RefUnwindSafe for Diagnostic<K>
impl<K> !UnwindSafe for Diagnostic<K>
impl<K> Forget for Diagnostic<K>
impl<K> Freeze for Diagnostic<K>
impl<K> Move for Diagnostic<K>
impl<K> Send for Diagnostic<K>
impl<K> Sync for Diagnostic<K>
impl<K> Unpin for Diagnostic<K>
impl<K> UnsafeUnpin for Diagnostic<K>where
Arc<BoxedData<K>>: UnsafeUnpin,
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
Mutably borrows from an owned value. Read more