Trait num_chrono_duration::NumChronoDuration [−][src]
pub trait NumChronoDuration: 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; }
Expand description
Creates a new Duration from the specified number.
Required methods
fn nanoseconds(&self) -> Duration
fn nanoseconds(&self) -> Duration
Creates a new Duration from the specified number of nanoseconds.
use num_chrono_duration::NumChronoDuration; use chrono::Duration; assert_eq!(1.nanoseconds(), Duration::nanoseconds(1));
fn microseconds(&self) -> Duration
fn microseconds(&self) -> Duration
Creates a new Duration from the specified number of microseconds.
use num_chrono_duration::NumChronoDuration; use chrono::Duration; assert_eq!(1.microseconds(), Duration::microseconds(1));
fn milliseconds(&self) -> Duration
fn milliseconds(&self) -> Duration
Creates a new Duration from the specified number of milliseconds.
use num_chrono_duration::NumChronoDuration; use chrono::Duration; assert_eq!(1.milliseconds(), Duration::milliseconds(1));
Creates a new Duration from the specified number of seconds.
use num_chrono_duration::NumChronoDuration; use chrono::Duration; assert_eq!(1.seconds(), Duration::seconds(1));
Creates a new Duration from the specified number of minutes.
use num_chrono_duration::NumChronoDuration; use chrono::Duration; assert_eq!(1.minutes(), Duration::minutes(1));
Creates a new Duration from the specified number of hours.
use num_chrono_duration::NumChronoDuration; use chrono::Duration; assert_eq!(1.hours(), Duration::hours(1));
Creates a new Duration from the specified number of days.
use num_chrono_duration::NumChronoDuration; use chrono::Duration; assert_eq!(1.days(), Duration::days(1));