wee_woo

Trait ErrorExt

source
pub trait ErrorExt {
    // Required methods
    fn with_source<Source>(
        self,
        source: Source,
    ) -> ErrorWithSource<Self, Source>
       where Self: Sized;
    fn caused<Error>(self, error: Error) -> ErrorWithSource<Error, Self>
       where Self: Sized;
    fn display_with_sources<I>(&self, infix: I) -> DisplayWithSources<&Self, I>
       where Self: Sized;
}
Expand description

An extension trait for Errors.

Required Methods§

source

fn with_source<Source>(self, source: Source) -> ErrorWithSource<Self, Source>
where Self: Sized,

Attach a source to the current error.

The value of source will be returned by the Error::source and Error::cause implementations of the returned value. Note that the latter is deprecated.

See also ErrorExt::caused

source

fn caused<Error>(self, error: Error) -> ErrorWithSource<Error, Self>
where Self: Sized,

Set self as the source of the given error.

The value of self will be returned by the Error::source and Error::cause implementations of the returned value. Note that the latter is deprecated.

See also ErrorExt::with_source

source

fn display_with_sources<I>(&self, infix: I) -> DisplayWithSources<&Self, I>
where Self: Sized,

Display an Error and its sources with a separator.

Implementors§

source§

impl<This> ErrorExt for This
where This: Error,