simpleos 0.6.3

A Simple OS use for MCU, that implements single-threaded asynchronous runtime.
use core::future::Future;
use core::pin::Pin;
use core::task::{Context, Poll};

pub struct YieldNowFuture {
    yielded: bool,
}

impl Future for YieldNowFuture {
    type Output = ();

    fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
        if self.yielded {
            Poll::Ready(())
        } else {
            self.yielded = true;
            cx.waker().wake_by_ref();
            Poll::Pending
        }
    }
}

#[allow(unused)]
pub fn yield_now() -> YieldNowFuture {
    YieldNowFuture { yielded: false }
}