tcp::util::time

Trait Duration

source
pub trait Duration:
    'static
    + Sized
    + Copy
    + Clone
    + Debug
    + Add<Output = Self>
    + AddAssign
    + Sub<Output = Self>
    + SubAssign
    + Mul<u32>
    + MulAssign<u32>
    + Div<u32>
    + DivAssign<u32>
    + PartialOrd
    + Ord
    + PartialEq
    + Eq
    + Hash {
    const MAX: Self;
    const NANOSECOND: Self;
    const MICROSECOND: Self;
    const MILLISECOND: Self;
    const SECOND: Self;
    const ZERO: Self;
Show 19 methods // Required methods fn as_micros(&self) -> u128; fn as_millis(&self) -> u128; fn as_nanos(&self) -> u128; fn as_secs(&self) -> u64; fn checked_add(self, rhs: Self) -> Option<Self>; fn checked_div(self, rhs: u32) -> Option<Self>; fn checked_mul(self, rhs: u32) -> Option<Self>; fn checked_sub(self, rhs: Self) -> Option<Self>; fn from_micros(micros: u64) -> Self; fn from_millis(millis: u64) -> Self; fn from_nanos(nanos: u64) -> Self; fn from_secs(secs: u64) -> Self; fn is_zero(&self) -> bool; fn saturating_add(self, rhs: Self) -> Self; fn saturating_mul(self, rhs: u32) -> Self; fn saturating_sub(self, rhs: Self) -> Self; fn subsec_micros(&self) -> u32; fn subsec_millis(&self) -> u32; fn subsec_nanos(&self) -> u32;
}
Expand description

A trait for time durations that follow the API of std::time::Duration. This is useful for code that should work with not just the real time, but also simulated time.

Required Associated Constants§

Required Methods§

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Duration for Duration

Calls into std::time::Duration methods of the same name.

source§

const MAX: Self = Self::MAX

source§

const NANOSECOND: Self = _

source§

const MICROSECOND: Self = _

source§

const MILLISECOND: Self = _

source§

const SECOND: Self = _

source§

const ZERO: Self = Self::ZERO

source§

fn as_micros(&self) -> u128

source§

fn as_millis(&self) -> u128

source§

fn as_nanos(&self) -> u128

source§

fn as_secs(&self) -> u64

source§

fn checked_add(self, rhs: Self) -> Option<Self>

source§

fn checked_div(self, rhs: u32) -> Option<Self>

source§

fn checked_mul(self, rhs: u32) -> Option<Self>

source§

fn checked_sub(self, rhs: Self) -> Option<Self>

source§

fn from_micros(micros: u64) -> Self

source§

fn from_millis(millis: u64) -> Self

source§

fn from_nanos(nanos: u64) -> Self

source§

fn from_secs(secs: u64) -> Self

source§

fn is_zero(&self) -> bool

source§

fn saturating_add(self, rhs: Self) -> Self

source§

fn saturating_mul(self, rhs: u32) -> Self

source§

fn saturating_sub(self, rhs: Self) -> Self

source§

fn subsec_micros(&self) -> u32

source§

fn subsec_millis(&self) -> u32

source§

fn subsec_nanos(&self) -> u32

Implementors§