pub fn poll_fn<T, F>(f: F) -> PollFn<F> ⓘ
Expand description
Creates a future from a function returning Poll
.
use futures_lite::future;
use std::task::{Context, Poll};
fn f(_: &mut Context<'_>) -> Poll<i32> {
Poll::Ready(7)
}
assert_eq!(future::poll_fn(f).await, 7);