mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 21:56:42 +01:00
time: clock: add next_launch_instant, modularize
This commit is contained in:
parent
13444dc59a
commit
24bc33d3d0
4 changed files with 81 additions and 61 deletions
18
crates/time/src/clock.rs
Normal file
18
crates/time/src/clock.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use crate::*;
|
||||
|
||||
mod clock_api; pub use self::clock_api::*;
|
||||
mod clock_model; pub use self::clock_model::*;
|
||||
|
||||
pub trait HasClock: Send + Sync {
|
||||
fn clock (&self) -> &Clock;
|
||||
fn clock_mut (&mut self) -> &mut Clock;
|
||||
}
|
||||
|
||||
#[macro_export] macro_rules! has_clock {
|
||||
(|$self:ident:$Struct:ident$(<$($L:lifetime),*$($T:ident$(:$U:path)?),*>)?|$cb:expr) => {
|
||||
impl $(<$($L),*$($T $(: $U)?),*>)? HasClock for $Struct $(<$($L),*$($T),*>)? {
|
||||
fn clock (&$self) -> &Clock { &$cb }
|
||||
fn clock_mut (&mut $self) -> &mut Clock { &mut $cb }
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue