[−][src]Macro futures_lite::ready
Unwraps Poll<T>
or returns Pending
.
Examples
use futures_lite::*; use std::pin::Pin; use std::task::{Context, Poll}; // 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) }