TimeOps

Trait TimeOps 

Source
pub trait TimeOps: RuntimeAdapter {
    type Instant: Clone + Send + Sync + Debug + 'static;
    type Duration: Clone + Send + Sync + Debug + 'static;

    // Required methods
    fn now(&self) -> Self::Instant;
    fn duration_since(
        &self,
        later: Self::Instant,
        earlier: Self::Instant,
    ) -> Option<Self::Duration>;
    fn millis(&self, ms: u64) -> Self::Duration;
    fn secs(&self, secs: u64) -> Self::Duration;
    fn micros(&self, micros: u64) -> Self::Duration;
    fn sleep(&self, duration: Self::Duration) -> impl Future<Output = ()> + Send;
}
Expand description

Time operations trait - enables ctx.time() accessor

Required Associated Types§

Source

type Instant: Clone + Send + Sync + Debug + 'static

Source

type Duration: Clone + Send + Sync + Debug + 'static

Required Methods§

Source

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

Source

fn duration_since( &self, later: Self::Instant, earlier: Self::Instant, ) -> Option<Self::Duration>

Source

fn millis(&self, ms: u64) -> Self::Duration

Source

fn secs(&self, secs: u64) -> Self::Duration

Source

fn micros(&self, micros: u64) -> Self::Duration

Source

fn sleep(&self, duration: Self::Duration) -> impl Future<Output = ()> + 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§