Trait error_stack::future::FutureExt

source ·
pub trait FutureExt: Future + Sized {
    // Required methods
    fn attach<A>(self, attachment: A) -> FutureWithAttachment<Self, A> 
       where A: Send + Sync + 'static;
    fn attach_lazy<A, F>(
        self,
        attachment: F,
    ) -> FutureWithLazyAttachment<Self, F> 
       where A: Send + Sync + 'static,
             F: FnOnce() -> A;
    fn attach_printable<A>(
        self,
        attachment: A,
    ) -> FutureWithPrintableAttachment<Self, A> 
       where A: Display + Debug + Send + Sync + 'static;
    fn attach_printable_lazy<A, F>(
        self,
        attachment: F,
    ) -> FutureWithLazyPrintableAttachment<Self, F> 
       where A: Display + Debug + Send + Sync + 'static,
             F: FnOnce() -> A;
    fn change_context<C>(self, context: C) -> FutureWithContext<Self, C> 
       where C: Context;
    fn change_context_lazy<C, F>(
        self,
        context: F,
    ) -> FutureWithLazyContext<Self, F> 
       where C: Context,
             F: FnOnce() -> C;
}
Expand description

Extension trait for Future to provide contextual information on Reports.

Required Methods§

source

fn attach<A>(self, attachment: A) -> FutureWithAttachment<Self, A>
where A: Send + Sync + 'static,

Adds a new attachment to the Report inside the Result when polling the Future.

Applies Report::attach on the Err variant, refer to it for more information.

source

fn attach_lazy<A, F>(self, attachment: F) -> FutureWithLazyAttachment<Self, F>
where A: Send + Sync + 'static, F: FnOnce() -> A,

Lazily adds a new attachment to the Report inside the Result when polling the Future.

Applies Report::attach on the Err variant, refer to it for more information.

source

fn attach_printable<A>( self, attachment: A, ) -> FutureWithPrintableAttachment<Self, A>
where A: Display + Debug + Send + Sync + 'static,

Adds a new printable attachment to the Report inside the Result when polling the Future.

Applies Report::attach_printable on the Err variant, refer to it for more information.

source

fn attach_printable_lazy<A, F>( self, attachment: F, ) -> FutureWithLazyPrintableAttachment<Self, F>
where A: Display + Debug + Send + Sync + 'static, F: FnOnce() -> A,

Lazily adds a new printable attachment to the Report inside the Result when polling the Future.

Applies Report::attach_printable on the Err variant, refer to it for more information.

source

fn change_context<C>(self, context: C) -> FutureWithContext<Self, C>
where C: Context,

Changes the Context of the Report inside the Result when polling the Future.

Applies Report::change_context on the Err variant, refer to it for more information.

source

fn change_context_lazy<C, F>(self, context: F) -> FutureWithLazyContext<Self, F>
where C: Context, F: FnOnce() -> C,

Lazily changes the Context of the Report inside the Result when polling the Future.

Applies Report::change_context on the Err variant, refer to it for more information.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Fut: Future> FutureExt for Fut
where Fut::Output: ResultExt,