Struct native_timer::Timer

source ·
pub struct Timer<'h> { /* private fields */ }
Expand description

Represents an instance of scheduled timer for a specific task.

Timer instance owns1 the space for the task’s closure. So when the timer is out of scope, it is forced to stop and destroy the closure during Drop processing.


  1. However, TimerQueue::fire_onshot does not create Timer instance. That’s why the function need a 'static closure lifetime. 

Implementations§

Reset the timer with a new due time and a new period.

Manually close the timer. It is safe to call this method more than once, but it is not thread-safe.

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.