dope_fiber/task/time/
clock.rs1use std::task;
4
5use crate::{abi, context, core::driver::schedule::clock};
6
7pub enum Clock {}
9
10impl Clock {
11 pub const fn now() -> Now {
12 Now
13 }
14}
15
16#[must_use = "a clock projection does nothing unless it is driven"]
19pub struct Now;
20
21impl<'d> abi::Fiber<'d> for Now {
22 type Output = clock::Moment<'d>;
23
24 fn poll(call: context::PollCall<'_, '_, 'd, Self>) -> task::Poll<Self::Output> {
25 let mut context = call.into_context();
26 task::Poll::Ready(context.as_mut().driver().driver_ref().clock().now())
27 }
28}
29
30const _: () = assert!(std::mem::size_of::<Now>() == 0);