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§
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
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.