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>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Instant for Instant
Calls into std::time::Instant methods of the same name.
impl Instant for Instant
Calls into std::time::Instant methods of the same name.