async-gen 0.3.0

Async generator in stable rust using async/await
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::pin::pin;
use std::{future::Future, task::*};

#[inline]
pub fn poll_once<T>(fut: impl Future<Output = T>) -> T {
    let mut cx = const { Context::from_waker(Waker::noop()) };
    let fut = pin!(fut);
    match fut.poll(&mut cx) {
        Poll::Ready(val) => val,
        Poll::Pending => panic!("pending"),
    }
}