[−][src]Function ufut::poll_state
pub fn poll_state<F, S, T>(state: S, fun: F) -> PollState<F, S>ⓘ where
F: FnMut(&mut S, &mut Context<'_>) -> Poll<T>,
Creates a future from a function returning Poll
that has
access to a provided state value.
Examples
use futures_lite::future::block_on; use futures_micro::poll_state; use std::task::{Context, Poll}; fn f(state: &mut i32, _ctx: &mut Context<'_>) -> Poll<i32> { Poll::Ready(*state + 1) } assert_eq!(poll_state(7, f).await, 8);