[−][src]Struct nuuro::Timer
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,