Function select
fn select<A, B>(future1: A, future2: B) -> Select<A, B>
where
A: Future + Unpin,
B: Future + Unpin
Waits for either one of two differently-typed futures to complete.
This function will return a new future which awaits for either one of both futures to complete. The returned future will finish with both the value resolved and a future representing the completion of the other work.
Note that this function consumes the receiving futures and returns a wrapped version of them.
Also note that if both this and the second future have the same
output type you can use the Either::factor_first method to
conveniently extract out the value at the end.
Examples
A simple example
# block_on;
A more complex example
use ;
// A poor-man's join implemented on top of select