Skip to main content

WallClockTimer

Trait WallClockTimer 

Source
pub trait WallClockTimer {
    type Id: Hash + Clone + Eq + Ord;
    type State: State<Id = Self::Id>;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn schedule_at(
        &mut self,
        deadline: SystemTime,
        state: Self::State,
    ) -> Result<(), Self::Error>;
    fn cancel(&mut self, id: Self::Id) -> Result<(), Self::Error>;
}
Expand description

A low-level wall-clock timer API.

Required Associated Types§

Source

type Id: Hash + Clone + Eq + Ord

A type to uniquely identify any timeout to be scheduled or cancelled.

Source

type State: State<Id = Self::Id>

The type of state to keep for timers.

Source

type Error: Error + Send + Sync + 'static

Error type produced by timer operations.

Required Methods§

Source

fn schedule_at( &mut self, deadline: SystemTime, state: Self::State, ) -> Result<(), Self::Error>

Schedule the state to be triggered at the given wall-clock deadline.

Source

fn cancel(&mut self, id: Self::Id) -> Result<(), Self::Error>

Cancel the timer indicated by the unique id.

Implementors§

Source§

impl<I, O> WallClockTimer for TimerRef<I, O>
where I: Hash + Clone + Eq + Ord, O: State<Id = I>,