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

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));

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));

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));

Creates a new Duration from the specified number of weeks.

use num_time_duration::NumTimeDuration;
use std::time::Duration;

assert_eq!(1.weeks(), Duration::from_secs(604800));

Implementations on Foreign Types

Implementors