Skip to main content

ErrorEnvelope

Trait ErrorEnvelope 

Source
pub trait ErrorEnvelope:
    ErrorContext
    + Debug
    + Display {
    type Kind: ErrorKind;
    type Envelope<K: ErrorKind>: ErrorEnvelope;

    // Required methods
    fn convert<K>(self) -> Self::Envelope<K>
       where K: ErrorKind + From<Self::Kind>;
    fn error_kind(&self) -> Self::Kind;
    fn new(error_kind: Self::Kind) -> Self;
    fn with_description<S>(error_kind: Self::Kind, description: S) -> Self
       where S: StaticString;
}
Expand description

Wraps an ErrorKind collecting optional debugging information.

For more information about this trait, see the envelopes module.

Required Associated Types§

Source

type Kind: ErrorKind

The ErrorKind contained within this envelope.

Source

type Envelope<K: ErrorKind>: ErrorEnvelope

How to map one ErrorKind to another within this envelope.

Required Methods§

Source

fn convert<K>(self) -> Self::Envelope<K>
where K: ErrorKind + From<Self::Kind>,

Converts the underlying error kind into a compatible error kind.

Source

fn error_kind(&self) -> Self::Kind

The error kind held within this envelope.

Source

fn new(error_kind: Self::Kind) -> Self

Constructs a new envelope with the provided error_kind.

Source

fn with_description<S>(error_kind: Self::Kind, description: S) -> Self
where S: StaticString,

Constructs a new envelope with the provided error_kind and description.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<K: ErrorKind> ErrorEnvelope for Described<K>

Available on crate feature alloc only.
Source§

impl<K: ErrorKind> ErrorEnvelope for Diagnostic<K>

Available on crate feature alloc only.
Source§

impl<K: ErrorKind> ErrorEnvelope for K

Source§

impl<K: ErrorKind> ErrorEnvelope for Located<K>