pub trait ErrorExt: Sealed {
type Output;
// Required methods
fn context<C>(self, context: C) -> Self::Output
where C: IntoCowStr;
fn with_context<C, F>(self, f: F) -> Self::Output
where C: IntoCowStr,
F: FnOnce() -> C;
}
Expand description
A trait providing ergonomic chaining capabilities to Error
.
Required Associated Types§
Sourcetype Output
type Output
The output type produced by context
and
with_context
.
Required Methods§
Sourcefn with_context<C, F>(self, f: F) -> Self::Outputwhere
C: IntoCowStr,
F: FnOnce() -> C,
fn with_context<C, F>(self, f: F) -> Self::Outputwhere
C: IntoCowStr,
F: FnOnce() -> C,
Add context to this error, using a closure for lazy evaluation.
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.