Macro futures_micro::ready[][src]

macro_rules! ready {
    ($e:expr $(,)?) => { ... };
}

Unwraps Poll<T> or returns Pending.

Examples

use futures_micro::*;

// Polls two futures and sums their results.
fn poll_sum(
    cx: &mut Context<'_>,
    mut a: impl Future<Output = i32> + Unpin,
    mut b: impl Future<Output = i32> + Unpin,
) -> Poll<i32> {
    let x = ready!(Pin::new(&mut a).poll(cx));
    let y = ready!(Pin::new(&mut b).poll(cx));
    Poll::Ready(x + y)
}