pub trait Instant:
'static
+ Sized
+ Copy
+ Clone
+ Debug
+ Add<Self::Duration, Output = Self>
+ AddAssign<Self::Duration>
+ Sub<Self::Duration, Output = Self>
+ Sub<Self, Output = Self::Duration>
+ SubAssign<Self::Duration>
+ PartialOrd
+ Ord
+ PartialEq
+ Eq
+ Hash {
type Duration: Duration;
// Required methods
fn duration_since(&self, earlier: Self) -> Self::Duration;
fn saturating_duration_since(&self, earlier: Self) -> Self::Duration;
fn checked_duration_since(&self, earlier: Self) -> Option<Self::Duration>;
fn checked_add(&self, duration: Self::Duration) -> Option<Self>;
fn checked_sub(&self, duration: Self::Duration) -> Option<Self>;
}
Expand description
A trait for time instants that follow the API of std::time::Instant
. This is useful for code
that should work with not just the real time, but also simulated time.
Required Associated Types§
Required Methods§
sourcefn duration_since(&self, earlier: Self) -> Self::Duration
fn duration_since(&self, earlier: Self) -> Self::Duration
sourcefn saturating_duration_since(&self, earlier: Self) -> Self::Duration
fn saturating_duration_since(&self, earlier: Self) -> Self::Duration
sourcefn checked_duration_since(&self, earlier: Self) -> Option<Self::Duration>
fn checked_duration_since(&self, earlier: Self) -> Option<Self::Duration>
sourcefn checked_add(&self, duration: Self::Duration) -> Option<Self>
fn checked_add(&self, duration: Self::Duration) -> Option<Self>
sourcefn checked_sub(&self, duration: Self::Duration) -> Option<Self>
fn checked_sub(&self, duration: Self::Duration) -> Option<Self>
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl Instant for Instant
impl Instant for Instant
Calls into std::time::Instant
methods of the same name.