use std::task;
use crate::{driver::schedule::clock, executor::task::Fiber, executor::task::context};
pub enum Clock {}
impl Clock {
pub const fn now() -> Now {
Now
}
}
#[must_use = "a clock projection does nothing unless it is driven"]
pub struct Now;
impl<'d> Fiber<'d> for Now {
type Output = clock::Moment<'d>;
fn poll(call: context::PollCall<'_, '_, 'd, Self>) -> task::Poll<Self::Output> {
let context = call.into_context();
task::Poll::Ready(context.driver().driver_ref().clock().now())
}
}
const _: () = assert!(std::mem::size_of::<Now>() == 0);