pub trait DurationNumExt: DurationNumExtFallible {
// Provided methods
fn seconds(&self) -> Duration { ... }
fn milliseconds(&self) -> Duration { ... }
fn microseconds(&self) -> Duration { ... }
fn nanoseconds(&self) -> Duration { ... }
fn minutes(&self) -> Duration { ... }
fn hours(&self) -> Duration { ... }
fn days(&self) -> Duration { ... }
}
Expand description
Extension methods for constructing std::time::Duration
with numbers.
§Note
This trait is not implemented for the Duration
,
for extension methods operating on a Duration
,
see crate::time::DurationExt
for more information.
Provided Methods§
Sourcefn milliseconds(&self) -> Duration
fn milliseconds(&self) -> Duration
Sourcefn microseconds(&self) -> Duration
fn microseconds(&self) -> Duration
Sourcefn nanoseconds(&self) -> Duration
fn nanoseconds(&self) -> Duration
Sourcefn minutes(&self) -> Duration
fn minutes(&self) -> Duration
Create a Duration
, using the postfix syntax.
§Example
use rs_std_ext::time::DurationNumExt;
use std::time::Duration;
assert_eq!(10u128.minutes(), Duration::from_secs(10u64 * 60));