[][src]Function futures_micro::next_poll

pub async fn next_poll<F: Future>(__arg0: F) -> Result<F::Output, F>

Polls a future once. If it does not succeed, return it to try again

Examples

use futures_micro::*;

let f = poll_state(false, |done: &mut bool, ctx: &mut Context<'_>| {
  if *done { Poll::Ready(1) } else { *done = true; Poll::Pending }
});
let f = next_poll(f).await.unwrap_err();
assert_eq!(f.await, 1);