DurationExt

Trait DurationExt 

Source
pub trait DurationExt {
    // Required methods
    fn seconds(self) -> Duration;
    fn minutes(self) -> Duration;
    fn hours(self) -> Duration;
    fn days(self) -> Duration;
    fn weeks(self) -> Duration;
    fn milliseconds(self) -> Duration;
    fn microseconds(self) -> Duration;
    fn nanoseconds(self) -> Duration;
}
Expand description

An extension trait that adds fluent time unit methods to integer primitives, allowing for highly readable time duration creation.

The functions return a standard Rust std::time::Duration.

Required Methods§

Source

fn seconds(self) -> Duration

Creates a Duration representing this many seconds.

Source

fn minutes(self) -> Duration

Creates a Duration representing this many minutes.

Source

fn hours(self) -> Duration

Creates a Duration representing this many hours.

Source

fn days(self) -> Duration

Creates a Duration representing this many days (24 hours).

Source

fn weeks(self) -> Duration

Creates a Duration representing this many weeks (7 days).

Source

fn milliseconds(self) -> Duration

Creates a Duration representing this many milliseconds.

Source

fn microseconds(self) -> Duration

Creates a Duration representing this many microseconds.

Source

fn nanoseconds(self) -> Duration

Creates a Duration representing this many nanoseconds.

Implementations on Foreign Types§

Source§

impl DurationExt for i32

Source§

impl DurationExt for i64

Source§

impl DurationExt for u32

Source§

impl DurationExt for u64

Implementors§