[][src]Struct nuuro::Timer

pub struct Timer { /* fields omitted */ }

Structure that allows calculating the time elapsed since its initialization or determining whether a certain period of time has elapsed.

Methods

impl Timer[src]

pub fn new(expiration_time: u64, start_active: bool) -> Timer[src]

Initialize a new Timer. If the expiration_time parameter equals 0, an endless Timer is started; if the parameter has any value (in milliseconds), a new Timer will start which will expire upon reaching this period of time. The timer_active parameter will determine if the Timer will start at once when initialized (note: if it is an endless timer, it will always be initialized started).

pub fn reset(&self)[src]

Reset the elapsed time of the timer to 0, and if it has not started before, the time will begin to elapse.

pub fn set_time(&self, expiration_time: u64, start_active: bool)[src]

Set a new expiration time for the timer and activation on start.

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

Get the timer status. If the expiration time has not been reached, the timer will be active.

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

Indicates if the timer has expired.

pub fn elapsed(&self) -> Duration[src]

Returns the time elapsed since the initialization of the last timer cycle.

pub fn elapsed_as_millis(&self) -> u64[src]

Returns the time elapsed since the initialization of the last timer cycle as milliseconds.

Trait Implementations

impl Clone for Timer[src]

impl Drop for Timer[src]

Auto Trait Implementations

impl RefUnwindSafe for Timer

impl Send for Timer

impl Sync for Timer

impl Unpin for Timer

impl UnwindSafe for Timer

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> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.