pub struct TimerQueue { /* private fields */ }Expand description
Timer queue managing setTimeout/setInterval
Implementations§
Source§impl TimerQueue
impl TimerQueue
pub fn new() -> Self
Sourcepub fn set_timeout(&mut self, callback_id: usize, delay_ticks: u64) -> u32
pub fn set_timeout(&mut self, callback_id: usize, delay_ticks: u64) -> u32
Schedule a one-shot timer (setTimeout). Returns the timer ID.
Sourcepub fn set_interval(&mut self, callback_id: usize, interval_ticks: u64) -> u32
pub fn set_interval(&mut self, callback_id: usize, interval_ticks: u64) -> u32
Schedule a repeating timer (setInterval). Returns the timer ID.
Sourcepub fn clear_timer(&mut self, timer_id: u32) -> bool
pub fn clear_timer(&mut self, timer_id: u32) -> bool
Cancel a timer by ID
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Check how many timers are pending
Sourcepub fn current_tick(&self) -> u64
pub fn current_tick(&self) -> u64
Current tick value