Trait failure::ResultExt
[−]
[src]
pub trait ResultExt<T, E> { fn compat(self) -> Result<T, Compat<E>>; fn context<D>(self, context: D) -> Result<T, Context<D>>
where
D: Display + Send + Sync + 'static; fn with_context<F, D>(self, f: F) -> Result<T, Context<D>>
where
F: FnOnce(&E) -> D,
D: Display + Send + Sync + 'static; }
Extension methods for Result
.
Required Methods
fn compat(self) -> Result<T, Compat<E>>
Wraps the error in Compat
to make it compatible with older error
handling APIs that expect std::error::Error
.
fn context<D>(self, context: D) -> Result<T, Context<D>> where
D: Display + Send + Sync + 'static,
D: Display + Send + Sync + 'static,
Wraps the error type in a context type.
fn with_context<F, D>(self, f: F) -> Result<T, Context<D>> where
F: FnOnce(&E) -> D,
D: Display + Send + Sync + 'static,
F: FnOnce(&E) -> D,
D: Display + Send + Sync + 'static,
Wraps the error type in a context type generated by looking at the error value.
Implementations on Foreign Types
impl<T, E> ResultExt<T, E> for Result<T, E> where
E: Fail,
[src]
E: Fail,