Trait futures_intrusive::timer::Timer
source · pub trait Timer {
fn delay(&self, delay: Duration) -> TimerFuture<'_>ⓘNotable traits for TimerFuture<'a>impl<'a> Future for TimerFuture<'a> type Output = ();
;
fn deadline(&self, timestamp: u64) -> TimerFuture<'_>ⓘNotable traits for TimerFuture<'a>impl<'a> Future for TimerFuture<'a> type Output = ();
;
}
Expand description
An asynchronously awaitable thread-safe timer.
The timer operates on millisecond precision and makes use of a configurable clock source.
The timer allows to wait asynchronously either for a certain duration,
or until the provided Clock
reaches a certain timestamp.
Required Methods
sourcefn delay(&self, delay: Duration) -> TimerFuture<'_>ⓘNotable traits for TimerFuture<'a>impl<'a> Future for TimerFuture<'a> type Output = ();
fn delay(&self, delay: Duration) -> TimerFuture<'_>ⓘNotable traits for TimerFuture<'a>impl<'a> Future for TimerFuture<'a> type Output = ();
Returns a future that gets fulfilled after the given Duration
sourcefn deadline(&self, timestamp: u64) -> TimerFuture<'_>ⓘNotable traits for TimerFuture<'a>impl<'a> Future for TimerFuture<'a> type Output = ();
fn deadline(&self, timestamp: u64) -> TimerFuture<'_>ⓘNotable traits for TimerFuture<'a>impl<'a> Future for TimerFuture<'a> type Output = ();
Returns a future that gets fulfilled when the utilized Clock
reaches
the given timestamp.