pub trait ResultExt<T>: Sealed {
// Required methods
fn map_kind(self, kind: ErrorKind) -> Result<T>
where Self: Sized;
fn context<C>(self, kind: ErrorKind, message: C) -> Result<T>
where Self: Sized,
C: Into<Cow<'static, str>>;
fn with_context<F, C>(self, kind: ErrorKind, f: F) -> Result<T>
where Self: Sized,
F: FnOnce() -> C,
C: Into<Cow<'static, str>>;
}
Expand description
An extension to the Result
type that easy allows creating Error
values from existing errors
This trait cannot be implemented on custom types and is meant for usage with Result
Required Methods§
sourcefn map_kind(self, kind: ErrorKind) -> Result<T>where
Self: Sized,
fn map_kind(self, kind: ErrorKind) -> Result<T>where
Self: Sized,
Creates a new error with the specified kind