Skip to main content

FutureExt

Trait FutureExt 

Source
pub trait FutureExt: Future + Sized {
    // Required methods
    fn attach<A>(self, attachment: A) -> FutureWithAttachment<Self, A> 
       where A: Attachment;
    fn attach_with<A, F>(
        self,
        attachment: F,
    ) -> FutureWithLazyAttachment<Self, F> 
       where A: Attachment,
             F: FnOnce() -> A;
    fn attach_opaque<A>(
        self,
        attachment: A,
    ) -> FutureWithOpaqueAttachment<Self, A> 
       where A: OpaqueAttachment;
    fn attach_opaque_with<A, F>(
        self,
        attachment: F,
    ) -> FutureWithLazyOpaqueAttachment<Self, F> 
       where A: OpaqueAttachment,
             F: FnOnce() -> A;
    fn change_context<C>(self, context: C) -> FutureWithContext<Self, C> 
       where C: Error + Send + Sync + 'static;
    fn change_context_lazy<C, F>(
        self,
        context: F,
    ) -> FutureWithLazyContext<Self, F> 
       where C: Error + Send + Sync + 'static,
             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: Attachment,

Adds a new printable 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_with<A, F>(self, attachment: F) -> FutureWithLazyAttachment<Self, F>
where A: Attachment, F: FnOnce() -> A,

Lazily adds a new printable 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_opaque<A>(self, attachment: A) -> FutureWithOpaqueAttachment<Self, A>

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

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

Source

fn attach_opaque_with<A, F>( self, attachment: F, ) -> FutureWithLazyOpaqueAttachment<Self, F>
where A: OpaqueAttachment, F: FnOnce() -> A,

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

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

Source

fn change_context<C>(self, context: C) -> FutureWithContext<Self, C>
where C: Error + Send + Sync + 'static,

Changes the Error 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: Error + Send + Sync + 'static, F: FnOnce() -> C,

Lazily changes the Error 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.

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<Fut: Future> FutureExt for Fut
where Fut::Output: ResultExt,