[][src]Struct pushrod::widgets::timer_widget::TimerWidget

pub struct TimerWidget { /* fields omitted */ }

This is the storage object for the TimerWidget. It stores the config, properties, callback registry, an enabled flag, timeout, a last-time-triggered value, and a timeout callback store.

Methods

impl TimerWidget[src]

Creates a new TimerWidget. This Widget will call a function defined in on_timeout when a specific number of milliseconds has elapsed.

pub fn new(timeout: u64, enabled: bool) -> Self[src]

Creates a new TimerWidget object to call the on_timeout timeout callback every timeout milliseconds. Setting enabled to true will automatically enable the timer, where as false will add the timer, but it will not be enabled.

pub fn enable(&mut self)[src]

Re-enables the timer. This will also reset the elapsed timer.

pub fn disable(&mut self)[src]

Disables the timer. Once disabled, the on_timeout callback will never be called.

pub fn is_enabled(&self) -> bool[src]

Returns the enabled state.

pub fn on_timeout<F>(&mut self, callback: F) where
    F: FnMut(&mut TimerWidget, &[WidgetContainer], &[LayoutContainer]) + 'static, 
[src]

Assigns the callback closure that will be used when a timer tick is triggered.

Trait Implementations

impl Widget for TimerWidget[src]

This is the Widget implementation of the TimerWidget.

fn tick(&mut self, _widgets: &[WidgetContainer], _layouts: &[LayoutContainer])[src]

The TimerWidget responds to the tick callback, which is used to determine the timer display ticks. This function is only called when the timer tick occurs, so if there is a function inside the drawing loop that drops frames, this timer may not get called reliably.

fn as_any(&mut self) -> &mut dyn Any[src]

This function is a macro-created getter function that returns the Widget as an Any type. This allows the Widget trait to be downcast into a struct that implements the Widget trait.

fn get_config(&mut self) -> &mut WidgetConfig[src]

This function is a macro-created getter function that returns the Widget's configuration object as a borrowed mutable reference. This code is auto-generated using the default_widget_properties!() macro.

fn get_system_properties(&mut self) -> &mut HashMap<i32, String>[src]

This function is a macro-created getter function that returns the Widget's system properties as a borrowed mutable reference. This code is auto-generated using the default_widget_properties!() macro.

fn get_callbacks(&mut self) -> &mut CallbackRegistry[src]

This function is a macro-created getter function that returns the Widget's CallbackRegistry object as a borrowed mutable reference. This code is auto-generated using the default_widget_properties!() macro.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.