pub fn poll_fn<T, F>(f: F) -> PollFn<F> ⓘwhere F: FnMut(&mut Context<'_>) -> Poll<T>,
Creates a future from a function returning Poll.
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);