pub trait SaturatingTime: Sized + Copy {
// Required methods
fn anchor() -> Self;
fn max_value() -> Self;
fn min_value() -> Self;
fn checked_add(&self, duration: Duration) -> Option<Self>;
fn checked_sub(&self, duration: Duration) -> Option<Self>;
fn checked_duration_since(&self, earlier: Self) -> Option<Duration>;
}Expand description
An internal trait implementing the actual magic behind this.
Required Methods§
Sourcefn checked_add(&self, duration: Duration) -> Option<Self>
fn checked_add(&self, duration: Duration) -> Option<Self>
Performs a checked addition on this type.
Sourcefn checked_sub(&self, duration: Duration) -> Option<Self>
fn checked_sub(&self, duration: Duration) -> Option<Self>
Performs a checked subtraction on this type.
Sourcefn checked_duration_since(&self, earlier: Self) -> Option<Duration>
fn checked_duration_since(&self, earlier: Self) -> Option<Duration>
Performs a checked time delta on this type.
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 SaturatingTime for Instant
impl SaturatingTime for Instant
Source§fn checked_duration_since(&self, _earlier: Self) -> Option<Duration>
fn checked_duration_since(&self, _earlier: Self) -> Option<Duration>
DO NOT USE!
Instead, override the top-level provided implementation with the already
existing Instant::saturating_duration_since().