Skip to main content

SaturatingTime

Trait SaturatingTime 

Source
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§

Source

fn anchor() -> Self

Anchor method to obtain an instance of this type.

Source

fn max_value() -> Self

Returns the maximum value of this type.

Source

fn min_value() -> Self

Returns the minimum value of this type.

Source

fn checked_add(&self, duration: Duration) -> Option<Self>

Performs a checked addition on this type.

Source

fn checked_sub(&self, duration: Duration) -> Option<Self>

Performs a checked subtraction on this type.

Source

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

Source§

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().

Source§

fn anchor() -> Self

Source§

fn max_value() -> Self

Source§

fn min_value() -> Self

Source§

fn checked_add(&self, duration: Duration) -> Option<Self>

Source§

fn checked_sub(&self, duration: Duration) -> Option<Self>

Source§

impl SaturatingTime for SystemTime

Source§

fn anchor() -> Self

Source§

fn max_value() -> Self

Source§

fn min_value() -> Self

Source§

fn checked_add(&self, duration: Duration) -> Option<Self>

Source§

fn checked_sub(&self, duration: Duration) -> Option<Self>

Source§

fn checked_duration_since(&self, earlier: Self) -> Option<Duration>

Implementors§