Skip to main content

TimeUnits

Trait TimeUnits 

Source
pub trait TimeUnits: Copy + Sized {
    // Required methods
    fn ns(self) -> TSpan;
    fn us(self) -> TSpan;
    fn ms(self) -> TSpan;
    fn sec(self) -> TSpan;
    fn min(self) -> TSpan;
    fn hr(self) -> TSpan;
    fn days(self) -> TSpan;
    fn wk(self) -> TSpan;
    fn yr(self) -> TSpan;
    fn ago(self, scale: Scale) -> Dt;
    fn from_now(self, scale: Scale) -> Dt;
}
Expand description

Trait that adds ergonomic time-unit methods to integers and floats.

Import it explicitly to create TSpans directly from rust ints and floats: use deep_time::TimeUnits;

Required Methods§

Source

fn ns(self) -> TSpan

Source

fn us(self) -> TSpan

Source

fn ms(self) -> TSpan

Source

fn sec(self) -> TSpan

Source

fn min(self) -> TSpan

Source

fn hr(self) -> TSpan

Source

fn days(self) -> TSpan

Source

fn wk(self) -> TSpan

Source

fn yr(self) -> TSpan

Source

fn ago(self, scale: Scale) -> Dt

Source

fn from_now(self, scale: Scale) -> Dt

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 TimeUnits for f32

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for f64

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for i8

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for i16

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for i32

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for i64

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for i128

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for u8

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for u16

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for u32

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for u64

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Source§

impl TimeUnits for u128

Source§

fn ns(self) -> TSpan

Source§

fn us(self) -> TSpan

Source§

fn ms(self) -> TSpan

Source§

fn sec(self) -> TSpan

Source§

fn min(self) -> TSpan

Source§

fn hr(self) -> TSpan

Source§

fn days(self) -> TSpan

Source§

fn wk(self) -> TSpan

Source§

fn yr(self) -> TSpan

Source§

fn ago(self, scale: Scale) -> Dt

Source§

fn from_now(self, scale: Scale) -> Dt

Implementors§