pub trait Context<O, E: Into<Box<dyn StdError + Send + Sync + 'static>>> {
// Required methods
fn context<T: 'static + Display + Debug>(
self,
kind: T,
) -> Result<O, Error<T>>;
fn annotate(self) -> Result<O, Error<AnnotatedError>>;
fn map_context<T: 'static + Display + Debug, F: FnOnce(&E) -> T>(
self,
op: F,
) -> Result<O, Error<T>>;
}
Expand description
Convenience methods for Result<>
to turn the error into a decorated Error
Required Methods§
Sourcefn context<T: 'static + Display + Debug>(self, kind: T) -> Result<O, Error<T>>
fn context<T: 'static + Display + Debug>(self, kind: T) -> Result<O, Error<T>>
Decorate the error with a kind
of type T
and the source Location
Sourcefn annotate(self) -> Result<O, Error<AnnotatedError>>
fn annotate(self) -> Result<O, Error<AnnotatedError>>
Decorate the error just with the source Location
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.