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§
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.