Trait TimerApi

Source
pub trait TimerApi: Send + 'static {
    type Timer: Timer<Key = Self::Key, Instant = Self::Instant, Duration = Self::Duration, Message = Self::Message>;
    type Instant;
    type Duration;
    type Key;
    type Message;

    // Required methods
    fn cancel(
        &mut self,
        key: Self::Key,
    ) -> impl Future<Output = Result<(), TimerError>> + Send;
    fn schedule_once_at(
        &mut self,
        key: Self::Key,
        at: Self::Instant,
        msg: Self::Message,
    ) -> impl Future<Output = Result<(), TimerError>> + Send;
    fn schedule_once_after(
        &mut self,
        key: Self::Key,
        after: Self::Duration,
        msg: Self::Message,
    ) -> impl Future<Output = Result<(), TimerError>> + Send;
}

Required Associated Types§

Source

type Timer: Timer<Key = Self::Key, Instant = Self::Instant, Duration = Self::Duration, Message = Self::Message>

Source

type Instant

Source

type Duration

Source

type Key

Source

type Message

Required Methods§

Source

fn cancel( &mut self, key: Self::Key, ) -> impl Future<Output = Result<(), TimerError>> + Send

Source

fn schedule_once_at( &mut self, key: Self::Key, at: Self::Instant, msg: Self::Message, ) -> impl Future<Output = Result<(), TimerError>> + Send

Source

fn schedule_once_after( &mut self, key: Self::Key, after: Self::Duration, msg: Self::Message, ) -> impl Future<Output = Result<(), TimerError>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§