[][src]Function futures_micro::next_poll

pub fn next_poll<F>(f: F) -> impl Future<Output = Result<F::Output, F>> where
    F: Future + Unpin

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

Examples

use futures_micro::*;

let mut done = false;
let f = poll_fn(move |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);