Trait FutureErrorContext

Source
pub trait FutureErrorContext: Future + Sized {
    // Required methods
    fn context<D>(self, context: D) -> ContextFut<Self, D>
       where D: Display + Send + Sync + 'static;
    fn with_context<D, F>(self, f: F) -> WithContextFut<Self, F>
       where D: Display + Send + Sync + 'static,
             F: FnOnce() -> D;
}
Expand description

“Context” support for futures.

Required Methods§

Source

fn context<D>(self, context: D) -> ContextFut<Self, D>
where D: Display + Send + Sync + 'static,

Add context to the error returned by this future

Source

fn with_context<D, F>(self, f: F) -> WithContextFut<Self, F>
where D: Display + Send + Sync + 'static, F: FnOnce() -> D,

Add context created by provided function to the error returned by this future

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<F, E> FutureErrorContext for F
where F: Future<Error = E> + Sized, E: Into<Error>,