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§
Sourcefn milliseconds(self) -> Duration
fn milliseconds(self) -> Duration
Creates a Duration representing this many milliseconds.
Sourcefn microseconds(self) -> Duration
fn microseconds(self) -> Duration
Creates a Duration representing this many microseconds.
Sourcefn nanoseconds(self) -> Duration
fn nanoseconds(self) -> Duration
Creates a Duration representing this many nanoseconds.