use crate::prelude::*;
use core::ptr::null;
use std::task::{Context, RawWaker, RawWakerVTable, Waker};
static INSTANCE: Lazy<Waker> = Lazy::new(|| unsafe { Waker::from_raw(create_raw()) });
pub fn context() -> Context<'static> {
Context::from_waker(instance())
}
pub fn instance() -> &'static Waker {
&*INSTANCE
}
fn create_raw() -> RawWaker {
unsafe fn clone(_data: *const ()) -> RawWaker {
create_raw()
}
unsafe fn noop(_data: *const ()) {}
RawWaker::new(null(), &RawWakerVTable::new(clone, noop, noop, noop))
}