TimerStrategy

Trait TimerStrategy 

Source
pub trait TimerStrategy<S: Sleep> {
    // Required methods
    fn initial(&self) -> Instant;
    fn sleep(&self, old: Instant, interval: Duration) -> Instant;
}
Expand description

A trait for timer strategies.

Required Methods§

Source

fn initial(&self) -> Instant

Returns the initial instant.

Source

fn sleep(&self, old: Instant, interval: Duration) -> Instant

Sleep until the specified time. The first call receives the return value of TimerStrategy::initial as old, and subsequent calls receive the previous return value.

Trait Implementations§

Source§

impl<S: Sleep> TimerStrategy<S> for Box<dyn TimerStrategy<S>>

Source§

fn initial(&self) -> Instant

Returns the initial instant.
Source§

fn sleep(&self, old: Instant, interval: Duration) -> Instant

Sleep until the specified time. The first call receives the return value of TimerStrategy::initial as old, and subsequent calls receive the previous return value.

Implementations on Foreign Types§

Source§

impl<S: Sleep> TimerStrategy<S> for Box<dyn TimerStrategy<S>>

Source§

fn initial(&self) -> Instant

Source§

fn sleep(&self, old: Instant, interval: Duration) -> Instant

Implementors§

Source§

impl<S: Sleep> TimerStrategy<S> for FixedDelay<S>

Source§

impl<S: Sleep> TimerStrategy<S> for FixedSchedule<S>