Trait futures_concurrency::future::Race

source ·
pub trait Race {
    type Output;
    type Future: Future<Output = Self::Output>;

    // Required method
    fn race(self) -> Self::Future;
}
Expand description

Wait for the first future to complete.

Awaits multiple future at once, returning as soon as one completes. The other futures are cancelled.

Required Associated Types§

source

type Output

The resulting output type.

source

type Future: Future<Output = Self::Output>

Which kind of future are we turning this into?

Required Methods§

source

fn race(self) -> Self::Future

Wait for the first future to complete.

Awaits multiple futures at once, returning as soon as one completes. The other futures are cancelled.

This function returns a new future which polls all futures concurrently.

Implementations on Foreign Types§

source§

impl<Fut> Race for Vec<Fut>
where Fut: IntoFuture,

§

type Output = <Fut as IntoFuture>::Output

§

type Future = Race<<Fut as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<Fut, const N: usize> Race for [Fut; N]
where Fut: IntoFuture,

§

type Output = <Fut as IntoFuture>::Output

§

type Future = Race<<Fut as IntoFuture>::IntoFuture, N>

source§

fn race(self) -> Self::Future

source§

impl<T, A> Race for (A,)
where A: IntoFuture<Output = T>,

§

type Output = T

§

type Future = Race1<T, <A as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<T, A, B> Race for (A, B)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>,

§

type Output = T

§

type Future = Race2<T, <A as IntoFuture>::IntoFuture, <B as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<T, A, B, C> Race for (A, B, C)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>,

§

type Output = T

§

type Future = Race3<T, <A as IntoFuture>::IntoFuture, <B as IntoFuture>::IntoFuture, <C as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<T, A, B, C, D> Race for (A, B, C, D)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>, D: IntoFuture<Output = T>,

§

type Output = T

§

type Future = Race4<T, <A as IntoFuture>::IntoFuture, <B as IntoFuture>::IntoFuture, <C as IntoFuture>::IntoFuture, <D as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<T, A, B, C, D, E> Race for (A, B, C, D, E)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>, D: IntoFuture<Output = T>, E: IntoFuture<Output = T>,

§

type Output = T

§

type Future = Race5<T, <A as IntoFuture>::IntoFuture, <B as IntoFuture>::IntoFuture, <C as IntoFuture>::IntoFuture, <D as IntoFuture>::IntoFuture, <E as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<T, A, B, C, D, E, F> Race for (A, B, C, D, E, F)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>, D: IntoFuture<Output = T>, E: IntoFuture<Output = T>, F: IntoFuture<Output = T>,

§

type Output = T

§

type Future = Race6<T, <A as IntoFuture>::IntoFuture, <B as IntoFuture>::IntoFuture, <C as IntoFuture>::IntoFuture, <D as IntoFuture>::IntoFuture, <E as IntoFuture>::IntoFuture, <F as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<T, A, B, C, D, E, F, G> Race for (A, B, C, D, E, F, G)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>, D: IntoFuture<Output = T>, E: IntoFuture<Output = T>, F: IntoFuture<Output = T>, G: IntoFuture<Output = T>,

§

type Output = T

§

type Future = Race7<T, <A as IntoFuture>::IntoFuture, <B as IntoFuture>::IntoFuture, <C as IntoFuture>::IntoFuture, <D as IntoFuture>::IntoFuture, <E as IntoFuture>::IntoFuture, <F as IntoFuture>::IntoFuture, <G as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<T, A, B, C, D, E, F, G, H> Race for (A, B, C, D, E, F, G, H)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>, D: IntoFuture<Output = T>, E: IntoFuture<Output = T>, F: IntoFuture<Output = T>, G: IntoFuture<Output = T>, H: IntoFuture<Output = T>,

§

type Output = T

§

type Future = Race8<T, <A as IntoFuture>::IntoFuture, <B as IntoFuture>::IntoFuture, <C as IntoFuture>::IntoFuture, <D as IntoFuture>::IntoFuture, <E as IntoFuture>::IntoFuture, <F as IntoFuture>::IntoFuture, <G as IntoFuture>::IntoFuture, <H as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<T, A, B, C, D, E, F, G, H, I> Race for (A, B, C, D, E, F, G, H, I)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>, D: IntoFuture<Output = T>, E: IntoFuture<Output = T>, F: IntoFuture<Output = T>, G: IntoFuture<Output = T>, H: IntoFuture<Output = T>, I: IntoFuture<Output = T>,

§

type Output = T

§

type Future = Race9<T, <A as IntoFuture>::IntoFuture, <B as IntoFuture>::IntoFuture, <C as IntoFuture>::IntoFuture, <D as IntoFuture>::IntoFuture, <E as IntoFuture>::IntoFuture, <F as IntoFuture>::IntoFuture, <G as IntoFuture>::IntoFuture, <H as IntoFuture>::IntoFuture, <I as IntoFuture>::IntoFuture>

source§

fn race(self) -> Self::Future

source§

impl<T, A, B, C, D, E, F, G, H, I, J> Race for (A, B, C, D, E, F, G, H, I, J)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>, D: IntoFuture<Output = T>, E: IntoFuture<Output = T>, F: IntoFuture<Output = T>, G: IntoFuture<Output = T>, H: IntoFuture<Output = T>, I: IntoFuture<Output = T>, J: IntoFuture<Output = T>,

source§

impl<T, A, B, C, D, E, F, G, H, I, J, K> Race for (A, B, C, D, E, F, G, H, I, J, K)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>, D: IntoFuture<Output = T>, E: IntoFuture<Output = T>, F: IntoFuture<Output = T>, G: IntoFuture<Output = T>, H: IntoFuture<Output = T>, I: IntoFuture<Output = T>, J: IntoFuture<Output = T>, K: IntoFuture<Output = T>,

source§

impl<T, A, B, C, D, E, F, G, H, I, J, K, L> Race for (A, B, C, D, E, F, G, H, I, J, K, L)
where A: IntoFuture<Output = T>, B: IntoFuture<Output = T>, C: IntoFuture<Output = T>, D: IntoFuture<Output = T>, E: IntoFuture<Output = T>, F: IntoFuture<Output = T>, G: IntoFuture<Output = T>, H: IntoFuture<Output = T>, I: IntoFuture<Output = T>, J: IntoFuture<Output = T>, K: IntoFuture<Output = T>, L: IntoFuture<Output = T>,

Implementors§