[][src]Struct time::Duration

pub struct Duration { /* fields omitted */ }

ISO 8601 time duration with nanosecond precision. This also allows for the negative duration; see individual methods for details.

Methods

impl Duration
[src]

Makes a new Duration with given number of weeks. Equivalent to Duration::seconds(weeks * 7 * 24 * 60 * 60) with overflow checks. Panics when the duration is out of bounds.

Makes a new Duration with given number of days. Equivalent to Duration::seconds(days * 24 * 60 * 60) with overflow checks. Panics when the duration is out of bounds.

Makes a new Duration with given number of hours. Equivalent to Duration::seconds(hours * 60 * 60) with overflow checks. Panics when the duration is out of bounds.

Makes a new Duration with given number of minutes. Equivalent to Duration::seconds(minutes * 60) with overflow checks. Panics when the duration is out of bounds.

Makes a new Duration with given number of seconds. Panics when the duration is more than i64::MAX milliseconds or less than i64::MIN milliseconds.

Makes a new Duration with given number of milliseconds.

Makes a new Duration with given number of microseconds.

Makes a new Duration with given number of nanoseconds.

Runs a closure, returning the duration of time it took to run the closure.

Returns the total number of whole weeks in the duration.

Returns the total number of whole days in the duration.

Returns the total number of whole hours in the duration.

Returns the total number of whole minutes in the duration.

Returns the total number of whole seconds in the duration.

Returns the total number of whole milliseconds in the duration,

Returns the total number of whole microseconds in the duration, or None on overflow (exceeding 263 microseconds in either direction).

Returns the total number of whole nanoseconds in the duration, or None on overflow (exceeding 263 nanoseconds in either direction).

Add two durations, returning None if overflow occurred.

Subtract two durations, returning None if overflow occurred.

The minimum possible Duration: i64::MIN milliseconds.

The maximum possible Duration: i64::MAX milliseconds.

A duration where the stored seconds and nanoseconds are equal to zero.

Returns true if the duration equals Duration::zero().

Creates a time::Duration object from std::time::Duration

This function errors when original duration is larger than the maximum value supported for this type.

Creates a std::time::Duration object from time::Duration

This function errors when duration is less than zero. As standard library implementation is limited to non-negative values.

Trait Implementations

impl PartialEq<Duration> for Duration
[src]

impl Clone for Duration
[src]

Performs copy-assignment from source. Read more

impl Copy for Duration
[src]

impl Ord for Duration
[src]

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl Eq for Duration
[src]

impl PartialOrd<Duration> for Duration
[src]

impl Display for Duration
[src]

impl Debug for Duration
[src]

impl Add<Duration> for Duration
[src]

The resulting type after applying the + operator.

impl Add<Duration> for Timespec
[src]

The resulting type after applying the + operator.

impl Add<Duration> for SteadyTime
[src]

The resulting type after applying the + operator.

impl Add<Duration> for Tm
[src]

The resulting type after applying the + operator.

The resulting Tm is in UTC.

impl Sub<Duration> for Duration
[src]

The resulting type after applying the - operator.

impl Sub<Duration> for Timespec
[src]

The resulting type after applying the - operator.

impl Sub<Duration> for SteadyTime
[src]

The resulting type after applying the - operator.

impl Sub<Duration> for Tm
[src]

The resulting type after applying the - operator.

The resulting Tm is in UTC.

impl Mul<i32> for Duration
[src]

The resulting type after applying the * operator.

impl Div<i32> for Duration
[src]

The resulting type after applying the / operator.

impl Neg for Duration
[src]

The resulting type after applying the - operator.

Auto Trait Implementations

impl Send for Duration

impl Sync for Duration

Blanket Implementations

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]