Trait EasyDuration

Source
pub trait EasyDuration: Sized {
    // Required method
    fn seconds(self) -> Duration;

    // Provided methods
    fn minutes(self) -> Duration { ... }
    fn hours(self) -> Duration { ... }
    fn days(self) -> Duration { ... }
}
Expand description

A trait to simplify construction a std::time::Duration from numeric types.

The trait is implemented for the common numeric types, like i32, u32, …

Note that for signed integers, the absolute value will be used.

Required Methods§

Provided Methods§

Source

fn minutes(self) -> Duration

Source

fn hours(self) -> Duration

Source

fn days(self) -> Duration

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 EasyDuration for i8

Source§

impl EasyDuration for i16

Source§

impl EasyDuration for i32

Source§

impl EasyDuration for i64

Source§

impl EasyDuration for u8

Source§

impl EasyDuration for u16

Source§

impl EasyDuration for u32

Source§

impl EasyDuration for u64

Implementors§