Trait snafu::ErrorCompat

source ·
pub trait ErrorCompat {
    // Provided methods
    fn backtrace(&self) -> Option<&Backtrace> { ... }
    fn iter_chain(&self) -> ChainCompat<'_, '_> 
       where Self: AsErrorSource { ... }
}
Expand description

Backports changes to the Error trait to versions of Rust lacking them.

It is recommended to always call these methods explicitly so that it is easy to replace usages of this trait when you start supporting a newer version of Rust.

ErrorCompat::backtrace(&error); // Recommended
error.backtrace();              // Discouraged

Provided Methods§

source

fn backtrace(&self) -> Option<&Backtrace>

Returns a Backtrace that may be printed.

source

fn iter_chain(&self) -> ChainCompat<'_, '_>
where Self: AsErrorSource,

Returns an iterator for traversing the chain of errors, starting with the current error and continuing with recursive calls to Error::source.

To omit the current error and only traverse its sources, use skip(1).

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a, E> ErrorCompat for &'a E
where E: ErrorCompat,

source§

impl<E> ErrorCompat for Box<E>
where E: ErrorCompat,

Implementors§

source§

impl ErrorCompat for ConfigFileError

source§

impl ErrorCompat for snafu::guide::examples::backtrace::Error

source§

impl ErrorCompat for snafu::guide::examples::basic::Error

source§

impl ErrorCompat for Whatever