tomt_async 0.1.3

Primarily a dumping ground for personal async snippets that may be used in other ToMT projects. If this crate is useful to others please let us know.
Documentation
use std::{future::Future, task::Poll};

pub(crate) struct Yield{
    pub yielded: bool
}

impl Future
for Yield
{
    type Output = ();

    fn poll(
        self: std::pin::Pin<&mut Self>,
        cx: &mut std::task::Context<'_>
    ) -> std::task::Poll<Self::Output> {
        match self.yielded {
            false => {
                self.get_mut().yielded = true;
                cx.waker().wake_by_ref();

                Poll::Pending
            },
            true => Poll::Ready(()),
        }
    }
}