Skip to main content

TickStrategy

Trait TickStrategy 

Source
pub trait TickStrategy: Send {
    // Required methods
    fn should_tick(
        &mut self,
        screen_id: &str,
        tick_count: u64,
        active_screen: &str,
    ) -> TickDecision;
    fn name(&self) -> &str;

    // Provided methods
    fn on_screen_transition(&mut self, _from: &str, _to: &str) { ... }
    fn maintenance_tick(&mut self, _tick_count: u64) { ... }
    fn shutdown(&mut self) { ... }
    fn debug_stats(&self) -> Vec<(String, String)> { ... }
}
Expand description

Controls which inactive screens get ticked on each frame.

The runtime owns the invariant that the active screen is always ticked. Implementations should assume should_tick is only called for inactive screens that are still eligible for work.

Required Methods§

Source

fn should_tick( &mut self, screen_id: &str, tick_count: u64, active_screen: &str, ) -> TickDecision

Decide whether to tick an inactive screen on this frame.

Source

fn name(&self) -> &str

Human-readable strategy name for logs/debugging.

Provided Methods§

Source

fn on_screen_transition(&mut self, _from: &str, _to: &str)

Called when the runtime observes a screen transition.

Source

fn maintenance_tick(&mut self, _tick_count: u64)

Called periodically for maintenance work.

Source

fn shutdown(&mut self)

Called during clean shutdown.

Source

fn debug_stats(&self) -> Vec<(String, String)>

Optional key-value debug stats.

Implementors§