pub trait ErrorContext<T, K, E> {
// Required methods
fn err_context(self, kind: K) -> Result<T, E>;
fn err_context_with(self, kind: impl FnOnce() -> K) -> Result<T, E>;
}
Expand description
Helper trait to add context to errors.
Most likely you want to use the trait of the same name and API generated by declare_error_type.
Required Methods§
Sourcefn err_context(self, kind: K) -> Result<T, E>
fn err_context(self, kind: K) -> Result<T, E>
Add an error kind to the top of the error backtrace.
Sourcefn err_context_with(self, kind: impl FnOnce() -> K) -> Result<T, E>
fn err_context_with(self, kind: impl FnOnce() -> K) -> Result<T, E>
Add an error kind returned by a function to the top of the error
backtrace. The function should only be called if self
is indeed an
error.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.