Trait TimeSource

Source
pub trait TimeSource {
    type Instant: Copy + Clone + PartialEq + PartialOrd;

    // Required methods
    fn now(&self) -> Self::Instant;
    fn is_elapsed(&self, since: Self::Instant, timeout_ms: u64) -> bool;
}
Expand description

Minimal time provider trait for timeout tracking. Implement this for your platform.

Required Associated Types§

Source

type Instant: Copy + Clone + PartialEq + PartialOrd

Monotonic time point type

Required Methods§

Source

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

Get the current time

Source

fn is_elapsed(&self, since: Self::Instant, timeout_ms: u64) -> bool

Check if a timeout has occurred

Implementors§