Trait TimerTrait

Source
pub trait TimerTrait:
    AsRawDescriptor
    + IntoRawDescriptor
    + Send {
    // Required methods
    fn reset_oneshot(&mut self, dur: Duration) -> Result<()>;
    fn reset_repeating(&mut self, dur: Duration) -> Result<()>;
    fn wait(&mut self) -> Result<()>;
    fn mark_waited(&mut self) -> Result<bool>;
    fn clear(&mut self) -> Result<()>;
    fn resolution(&self) -> Result<Duration>;
}
Expand description

A trait for timer objects that delivers timer expiration notifications to an underlying descriptor.

Required Methods§

Source

fn reset_oneshot(&mut self, dur: Duration) -> Result<()>

Sets the timer to expire after dur without repeating. Cancels any existing timer.

Source

fn reset_repeating(&mut self, dur: Duration) -> Result<()>

Sets the timer to fire repeatedly at dur intervals. Cancels any existing timer.

Source

fn wait(&mut self) -> Result<()>

Waits until the timer expires.

Source

fn mark_waited(&mut self) -> Result<bool>

After a timer is triggered from an EventContext, mark the timer as having been waited for. If a timer is not marked waited, it will immediately trigger the event context again. This does not need to be called after calling Timer::wait.

Returns true if the timer has been adjusted since the EventContext was triggered by this timer.

Source

fn clear(&mut self) -> Result<()>

Disarms the timer.

Source

fn resolution(&self) -> Result<Duration>

Returns the resolution of timers on the host.

Implementors§