pub fn poll_fn<T, F>(f: F) -> PollFn<F>ⓘNotable traits for PollFn<F>impl<T, F> Future for PollFn<F> where F: FnMut(&mut Context<'_>) -> Poll<T>, type Output = T; where F: FnMut(&mut Context<'_>) -> Poll<T>,
impl<T, F> Future for PollFn<F> where F: FnMut(&mut Context<'_>) -> Poll<T>, type Output = 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);