Trait num_time_duration::NumTimeDuration [−][src]
pub trait NumTimeDuration: PrimInt { fn nanoseconds(&self) -> Duration; fn microseconds(&self) -> Duration; fn milliseconds(&self) -> Duration; fn seconds(&self) -> Duration; fn minutes(&self) -> Duration; fn hours(&self) -> Duration; fn days(&self) -> Duration; fn weeks(&self) -> Duration; }
Required methods
fn nanoseconds(&self) -> Duration
fn nanoseconds(&self) -> Duration
Creates a new Duration from the specified number of nanoseconds.
use num_time_duration::NumTimeDuration; use std::time::Duration; assert_eq!(1.nanoseconds(), Duration::from_nanos(1));
fn microseconds(&self) -> Duration
fn microseconds(&self) -> Duration
Creates a new Duration from the specified number of microseconds.
use num_time_duration::NumTimeDuration; use std::time::Duration; assert_eq!(1.microseconds(), Duration::from_micros(1));
fn milliseconds(&self) -> Duration
fn milliseconds(&self) -> Duration
Creates a new Duration from the specified number of milliseconds.
use num_time_duration::NumTimeDuration; use std::time::Duration; assert_eq!(1.milliseconds(), Duration::from_millis(1));
Creates a new Duration from the specified number of seconds.
use num_time_duration::NumTimeDuration; use std::time::Duration; assert_eq!(1.seconds(), Duration::from_secs(1));
Creates a new Duration from the specified number of minutes.
use num_time_duration::NumTimeDuration; use std::time::Duration; assert_eq!(1.minutes(), Duration::from_secs(60));
Creates a new Duration from the specified number of hours.
use num_time_duration::NumTimeDuration; use std::time::Duration; assert_eq!(1.hours(), Duration::from_secs(3600));
Creates a new Duration from the specified number of days.
use num_time_duration::NumTimeDuration; use std::time::Duration; assert_eq!(1.days(), Duration::from_secs(86400));