Timer
vectorlib::Timer — fields, methods, parameters and return types.
pub struct TimerA pausable countdown timer.
Methods
Prop
Type
new
pub fn new(time: u32) -> SelfConstruct a new timer. A timer is not paused when created.
time— how long to wait, in milliseconds
Parameters
Prop
Type
Returns
Selfget_time_set
pub fn get_time_set(&mut self) -> u32Get the amount of time the timer was set to wait.
Returns
u32get_time_left
pub fn get_time_left(&mut self) -> u32Get the amount of time left on the timer (0 if done).
Returns
u32get_time_passed
pub fn get_time_passed(&mut self) -> u32Get the amount of time passed on the timer.
Returns
u32is_done
pub fn is_done(&mut self) -> boolWhether the timer is done.
Returns
boolis_paused
pub fn is_paused(&mut self) -> boolWhether the timer is paused.
Faithful to LemLib: this accumulates elapsed time but does not update the last sample time, so calling it repeatedly on a running timer over-counts elapsed time.
Returns
boolset
pub fn set(&mut self, time: u32)Set the amount of time the timer should wait. Also resets the timer.
Parameters
Prop
Type
Returns
()reset
pub fn reset(&mut self)Reset the timer.
Returns
()pause
pub fn pause(&mut self)Pause the timer.
Returns
()resume
pub fn resume(&mut self)Resume the timer.
Returns
()wait_until_done
pub async fn wait_until_done(&mut self)Block until the timer is done.
Returns
()