[][src]Macro ufut::or

macro_rules! or {
    ($($es:expr),+$(,)?) => { ... };
}

Polls arbitrarily many futures, returning the first ready value.

All futures must have the same output type. Left biased when more than one Future is ready at the same time.

Examples

use futures_micro::prelude::*;

assert_eq!(or!(ready(1), pending::<i32>()).await, 1);
assert_eq!(or!(pending::<i32>(), ready(2)).await, 2);

// The first ready future wins.
assert_eq!(or!(ready(1), ready(2), ready(3)).await, 1);