[−][src]Function futures_lite::future::race
pub fn race<T, A, B>(future1: A, future2: B) -> Race<A, B>ⓘ where
A: Future<Output = T>,
B: Future<Output = T>,
Returns the result of the future that completes first.
Each time Race
is polled, the two inner futures are polled in random order. Therefore, no
future takes precedence over the other if both can complete at the same time.
Examples
use futures_lite::*; let a = future::pending(); let b = future::ready(7); assert_eq!(future::race(a, b).await, 7);