pub struct Timer { /* private fields */ }
Expand description

Posix timer wrapper

Implementations

Creates new uninitialized instance.

In order to use it one must call init.

Returns whether timer is initialized

Performs timer initialization

cb pointer to function to invoke when timer expires.

Returns whether timer has been initialized successfully or not.

If timer is already initialized does nothing, returning false.

Creates new timer, invoking provided cb when timer expires.

On failure, returns None

Schedules timer to alarm periodically with interval with initial alarm of timeout.

Note that if timer has been scheduled before, but hasn’t expire yet, behaviour is undefined (Callback may or may not be called). To prevent that user must cancel timer first.

Returns true if successfully set, otherwise on error returns false

Returns true if timer has been scheduled and still pending.

On Win/Mac it only returns whether timer has been scheduled, as there is no way to check whether timer is ongoing

Cancels ongoing timer, if it was scheduled.

Creates new schedule

Schedules timer to alarm once after timeout passes.

Note that if timer has been scheduled before, but hasn’t expire yet, it shall be cancelled. To prevent that user must cancel timer first.

Returns true if successfully set, otherwise on error returns false

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.