Trait Instant

Source
pub trait Instant: Clone + Copy {
    type Duration: Duration;

    // Required method
    fn saturating_duration_since(&self, earlier: Self) -> Self::Duration;
}
Expand description

Trait representing instants in time. Allows using maybenot frameworks with custom time sources. If you want to use maybenot with a different time source than std::time::Instant, implement this trait for your instant type, and the Duration trait for your corresponding duration type.

Required Associated Types§

Required Methods§

Source

fn saturating_duration_since(&self, earlier: Self) -> Self::Duration

Returns the amount of time elapsed from another instant to this one.

Should return a zero duration if earlier is later than self

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.

Implementations on Foreign Types§

Source§

impl Instant for Instant

Implementors§