vihaco_stdlib/clock/
traits.rs1use super::{GlobalTick, GlobalTicksPerLocalCycle, Schedule};
5
6pub trait TimedInstruction {
8 fn local_cycles(&self) -> super::LocalCycles;
9}
10
11pub trait ClockedComponent: Sized {
13 type Event;
14 type Completion;
15 type Fault;
16
17 fn step_at(
18 &mut self,
19 global_tick: GlobalTick,
20 ticks_per_local_cycle: GlobalTicksPerLocalCycle,
21 ) -> Result<Option<Schedule<Self::Event>>, Self::Fault>;
22
23 fn resume(
24 &mut self,
25 completion: Self::Completion,
26 global_tick: GlobalTick,
27 ticks_per_local_cycle: GlobalTicksPerLocalCycle,
28 ) -> Result<Option<Schedule<Self::Event>>, Self::Fault>;
29
30 fn next_boundary_at(
31 &self,
32 global_tick: GlobalTick,
33 ticks_per_local_cycle: GlobalTicksPerLocalCycle,
34 ) -> Result<GlobalTick, Self::Fault>;
35}