ErrorContext

Trait ErrorContext 

Source
pub trait ErrorContext<E: Error>
where Self: Sized + Into<E>,
{ // Provided methods fn context<T>(fun: impl FnOnce() -> Result<T, Self>) -> Result<T, E> { ... } fn context_async<T, F>( fun: impl FnOnce() -> F, ) -> impl Future<Output = Result<T, E>> where F: Future<Output = Result<T, Self>> { ... } }

Provided Methods§

Source

fn context<T>(fun: impl FnOnce() -> Result<T, Self>) -> Result<T, E>

Source

fn context_async<T, F>( fun: impl FnOnce() -> F, ) -> impl Future<Output = Result<T, E>>
where F: Future<Output = Result<T, Self>>,

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.

Implementors§

Source§

impl<EI, EO> ErrorContext<EO> for EI
where EI: Sized + Into<EO>, EO: Error,