pub trait TickHandler: Send + Sync {
// Required methods
fn tick_duration(&self) -> Duration;
fn on_tick(&self, tick_count: u64, now_ns: u64);
fn on_shutdown(&self);
}Expand description
Trait for services that need to be notified on each tick.
Required Methods§
Sourcefn tick_duration(&self) -> Duration
fn tick_duration(&self) -> Duration
Returns the desired tick duration for this handler. The TickService will use the minimum of all registered handlers’ tick durations.
Sourcefn on_tick(&self, tick_count: u64, now_ns: u64)
fn on_tick(&self, tick_count: u64, now_ns: u64)
Called on each tick with the current time in nanoseconds and tick count.
Sourcefn on_shutdown(&self)
fn on_shutdown(&self)
Called when the tick service is shutting down.