Trait Delta

Source
pub trait Delta {
    // Required method
    fn delta(&self, other: Self) -> u64;
}
Expand description

Trait for types that represent time and can be subtracted from each other to generate a delta.

Required Methods§

Source

fn delta(&self, other: Self) -> u64

Get the delta between this value and another value.

For Instant, we explicitly return the nanosecond difference. For u64, we return the integer difference, but the timescale itself can be whatever the user desires.

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 Delta for u64

Source§

fn delta(&self, other: u64) -> u64

Source§

impl Delta for Instant

Source§

fn delta(&self, other: Instant) -> u64

Implementors§