Trait base::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§
sourcefn reset_oneshot(&mut self, dur: Duration) -> Result<()>
fn reset_oneshot(&mut self, dur: Duration) -> Result<()>
Sets the timer to expire after dur
without repeating. Cancels any existing timer.
sourcefn reset_repeating(&mut self, dur: Duration) -> Result<()>
fn reset_repeating(&mut self, dur: Duration) -> Result<()>
Sets the timer to fire repeatedly at dur
intervals. Cancels any existing timer.
sourcefn mark_waited(&mut self) -> Result<bool>
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.
sourcefn resolution(&self) -> Result<Duration>
fn resolution(&self) -> Result<Duration>
Returns the resolution of timers on the host.