Trait futures_concurrency::Race
source · [−]pub trait Race {
type Output;
fn race<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + 'async_trait>>
where
Self: 'async_trait;
}
Expand description
Wait for the first future to complete.
Awaits multiple futures simultaneously, returning the output of the first future which completes.
Required Associated Types
Required Methods
sourcefn race<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + 'async_trait>>where
Self: 'async_trait,
fn race<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Self::Output> + 'async_trait>>where
Self: 'async_trait,
Waits for multiple futures to complete.
Awaits multiple futures simultaneously, returning the output of the futures once both complete.
This function returns a new future which polls both futures concurrently.