futures_concurrency::future

Trait RaceOk

source
pub trait RaceOk {
    type Output;
    type Error;
    type Future: Future<Output = Result<Self::Output, Self::Error>>;

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

Wait for the first successful future to complete.

Awaits multiple futures simultaneously, returning the output of the first future which completes. If no future completes successfully, returns an aggregate error of all failed futures.

Required Associated Types§

source

type Output

The resulting output type.

source

type Error

The resulting error type.

source

type Future: Future<Output = Result<Self::Output, Self::Error>>

Which kind of future are we turning this into?

Required Methods§

source

fn race_ok(self) -> Self::Future

Waits for the first successful future to complete.

Implementations on Foreign Types§

source§

impl<Fut, T, E> RaceOk for Vec<Fut>
where Fut: IntoFuture<Output = Result<T, E>>,

source§

impl<Fut, T, E, const N: usize> RaceOk for [Fut; N]
where Fut: IntoFuture<Output = Result<T, E>>,

source§

type Output = T

source§

type Error = AggregateError<E, N>

source§

type Future = RaceOk<<Fut as IntoFuture>::IntoFuture, T, E, N>

source§

fn race_ok(self) -> Self::Future

source§

impl<T, ERR, A> RaceOk for (A,)
where A: IntoFuture<Output = Result<T, ERR>>, ERR: Debug,

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

type Future = RaceOk1<T, ERR, <A as IntoFuture>::IntoFuture>

source§

fn race_ok(self) -> Self::Future

source§

impl<T, ERR, A, B> RaceOk for (A, B)
where A: IntoFuture<Output = Result<T, ERR>>, B: IntoFuture<Output = Result<T, ERR>>, ERR: Debug,

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

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

source§

fn race_ok(self) -> Self::Future

source§

impl<T, ERR, A, B, C> RaceOk for (A, B, C)
where A: IntoFuture<Output = Result<T, ERR>>, B: IntoFuture<Output = Result<T, ERR>>, C: IntoFuture<Output = Result<T, ERR>>, ERR: Debug,

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

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

source§

fn race_ok(self) -> Self::Future

source§

impl<T, ERR, A, B, C, D> RaceOk for (A, B, C, D)
where A: IntoFuture<Output = Result<T, ERR>>, B: IntoFuture<Output = Result<T, ERR>>, C: IntoFuture<Output = Result<T, ERR>>, D: IntoFuture<Output = Result<T, ERR>>, ERR: Debug,

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

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

source§

fn race_ok(self) -> Self::Future

source§

impl<T, ERR, A, B, C, D, E> RaceOk for (A, B, C, D, E)
where A: IntoFuture<Output = Result<T, ERR>>, B: IntoFuture<Output = Result<T, ERR>>, C: IntoFuture<Output = Result<T, ERR>>, D: IntoFuture<Output = Result<T, ERR>>, E: IntoFuture<Output = Result<T, ERR>>, ERR: Debug,

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

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

source§

fn race_ok(self) -> Self::Future

source§

impl<T, ERR, A, B, C, D, E, F> RaceOk for (A, B, C, D, E, F)
where A: IntoFuture<Output = Result<T, ERR>>, B: IntoFuture<Output = Result<T, ERR>>, C: IntoFuture<Output = Result<T, ERR>>, D: IntoFuture<Output = Result<T, ERR>>, E: IntoFuture<Output = Result<T, ERR>>, F: IntoFuture<Output = Result<T, ERR>>, ERR: Debug,

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

type Future = RaceOk6<T, ERR, <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_ok(self) -> Self::Future

source§

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

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

type Future = RaceOk7<T, ERR, <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_ok(self) -> Self::Future

source§

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

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

type Future = RaceOk8<T, ERR, <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_ok(self) -> Self::Future

source§

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

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

type Future = RaceOk9<T, ERR, <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_ok(self) -> Self::Future

source§

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

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

type Future = RaceOk10<T, ERR, <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, <J as IntoFuture>::IntoFuture>

source§

fn race_ok(self) -> Self::Future

source§

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

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

type Future = RaceOk11<T, ERR, <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, <J as IntoFuture>::IntoFuture, <K as IntoFuture>::IntoFuture>

source§

fn race_ok(self) -> Self::Future

source§

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

source§

type Output = T

source§

type Error = AggregateError<ERR, { $StructName }>

source§

type Future = RaceOk12<T, ERR, <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, <J as IntoFuture>::IntoFuture, <K as IntoFuture>::IntoFuture, <L as IntoFuture>::IntoFuture>

source§

fn race_ok(self) -> Self::Future

Implementors§