Struct kiss_ui::timer::Timer
[−]
[src]
pub struct Timer(_);
A timer that can invoke a callback on a configurable interval.
Note: Not a Renderable Widget
While this type can be dereferenced and converted to BaseWidget
, it is not a renderable
widget and adding it to a container will have no visual effect.
Note: Resource Usage
This struct should be freed by calling .destroy()
on it when it is no longer in use to free
any resources it has allocated. Otherwise, it will be freed when kiss_ui::show_gui()
returns.
Methods
impl Timer
fn new() -> Timer
Create a new timer with a default interval.
TODO: Document default interval.
fn set_interval(self, time: u32) -> Self
Set the timer interval in milliseconds.
fn set_on_interval<Cb>(self, on_interval: Cb) -> Self where Cb: Callback<Self>
Set a callback to be invoked when the timer interval elapses.
The callback will be invoked on every interval until .stop()
is called.
fn start(self) -> Self
Start the timer. The callback will be invoked when the next interval elapses.
fn stop(self) -> Self
Stop the timer. The callback will not be invoked until the timer is restarted.