pub async fn select_ab<A, B, FutA, FutB>(a: FutA, b: FutB) -> OptionAb<A, B> where
FutA: 'static + Future<Output = A> + Send,
FutB: 'static + Future<Output = B> + Send,
Expand description
Awaits both futures and returns the value from the one that completes first.
First moves them to the heap, to make them
Unpin
.
Use
SelectFuture::new
to avoid allocating on the heap.