macro_rules! ready {
($e:expr $(,)?) => { ... };
}
Expand description
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)
}