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(); // DiscouragedThis trait does not require Error, core::fmt::Debug, or
core::fmt::Display. Backtrace access and standard error-chain access
are separate capabilities; ErrorCompat::iter_chain additionally
requires AsErrorSource.
Provided Methods§
Sourcefn iter_chain(&self) -> ChainCompat<'_, '_> ⓘwhere
Self: AsErrorSource,
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).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<'a, E> ErrorCompat for &'a Ewhere
E: ErrorCompat,
impl<'a, E> ErrorCompat for &'a Ewhere
E: ErrorCompat,
Source§impl<E> ErrorCompat for Box<E>where
E: ErrorCompat,
Available on crate features alloc only.
impl<E> ErrorCompat for Box<E>where
E: ErrorCompat,
alloc only.Implementors§
impl ErrorCompat for ConfigFileError
guide only.impl ErrorCompat for snafu::guide::examples::backtrace::Error
guide only.impl ErrorCompat for snafu::guide::examples::basic::Error
guide only.impl ErrorCompat for Whatever
alloc only.impl ErrorCompat for WhateverLocal
alloc only.