Skip to main content

FutureRaceCompletionPoolExt

Trait FutureRaceCompletionPoolExt 

Source
pub trait FutureRaceCompletionPoolExt: Future + Sized {
    // Required method
    fn race_complete_on<R, F>(
        self,
        pool: FutureRaceCompletionPool,
        race_fut: F,
    ) -> impl Future<Output = FutureRaceCompletion<Self::Output, R>> + Send
       where Self: Send + 'static,
             Self::Output: Send + 'static,
             F: Future<Output = R> + Send,
             R: Send;
}
Expand description

Trait that adds race_complete_on to any future

Required Methods§

Source

fn race_complete_on<R, F>( self, pool: FutureRaceCompletionPool, race_fut: F, ) -> impl Future<Output = FutureRaceCompletion<Self::Output, R>> + Send
where Self: Send + 'static, Self::Output: Send + 'static, F: Future<Output = R> + Send, R: Send,

Race self against race_fut. If race_fut finishes first, hand self off to pool to run to completion in the background and return Race(_). Otherwise return Original(_) with the value self produced.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<Fut> FutureRaceCompletionPoolExt for Fut
where Fut: Future,