Timer

Trait Timer 

Source
pub trait Timer:
    Clone
    + Send
    + Sync
    + Debug
    + 'static {
    type Sleep: Future<Output = ()>;
    type Instant: Copy + Debug + Ord + Send + Sync + Add<Duration, Output = Self::Instant> + Sub<Duration, Output = Self::Instant> + Sub<Self::Instant, Output = Duration>;

    // Required methods
    fn sleep_future(&self, duration: Duration) -> Self::Sleep;
    fn now(&self) -> Self::Instant;
}

Required Associated Types§

Source

type Sleep: Future<Output = ()>

Source

type Instant: Copy + Debug + Ord + Send + Sync + Add<Duration, Output = Self::Instant> + Sub<Duration, Output = Self::Instant> + Sub<Self::Instant, Output = Duration>

Required Methods§

Source

fn sleep_future(&self, duration: Duration) -> Self::Sleep

Source

fn now(&self) -> Self::Instant

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§

Source§

impl Timer for TokioTimer

Available on crate feature runtime-tokio only.