Skip to main content

RepeaterEntry

Trait RepeaterEntry 

Source
pub trait RepeaterEntry {
    type Key: Hash + Eq + Unpin + Send + Debug;

    // Required methods
    fn interval(&self) -> Duration;
    fn key(&self) -> Self::Key;

    // Provided method
    fn delay(&self) -> Delay { ... }
}
Expand description

Entry for the Repeater

Required Associated Types§

Source

type Key: Hash + Eq + Unpin + Send + Debug

The type of key

Required Methods§

Source

fn interval(&self) -> Duration

Duration after which the entry should be repeated

Source

fn key(&self) -> Self::Key

To identify the entry.

We don’t want to store the whole entry in the underlying queue, but only a key

Provided Methods§

Source

fn delay(&self) -> Delay

Duration after which the first repetition is run

An example: It’s 2:57pm and we want to start a repetition with an interval of 60 seconds, but also want to wait until it’s exactly 3pm. We’d either set the delay to be relative 180 seconds or specify the absolute unix time stamp.

If not implemented, it returns Delay::None starting the repetition instantly

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§