vihaco_stdlib/clock/
error.rs1#[derive(Debug, PartialEq, Eq)]
6pub enum ClockFault {
7 ZeroTickRatio,
8 LocalCycleOverflow,
9 DurationOverflow,
10 GlobalTickOverflow,
11 SequenceOverflow,
12 SchedulingInPast,
13}
14
15impl std::fmt::Display for ClockFault {
16 fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17 let message = match self {
18 Self::ZeroTickRatio => "global ticks per local cycle must be nonzero",
19 Self::LocalCycleOverflow => "local cycle arithmetic overflowed",
20 Self::DurationOverflow => "global duration arithmetic overflowed",
21 Self::GlobalTickOverflow => "global tick arithmetic overflowed",
22 Self::SequenceOverflow => "global clock sequence overflowed",
23 Self::SchedulingInPast => "cannot schedule an event in the past",
24 };
25 formatter.write_str(message)
26 }
27}
28
29impl std::error::Error for ClockFault {}