[][src]Struct coder::models::Duration

pub struct Duration(_);

Duration is a wrapper around chrono::Duration that Serializes into and Deserializes from millisecond precision integers.

Methods from Deref<Target = Duration>

pub fn num_weeks(&self) -> i64[src]

Returns the total number of whole weeks in the duration.

pub fn num_days(&self) -> i64[src]

Returns the total number of whole days in the duration.

pub fn num_hours(&self) -> i64[src]

Returns the total number of whole hours in the duration.

pub fn num_minutes(&self) -> i64[src]

Returns the total number of whole minutes in the duration.

pub fn num_seconds(&self) -> i64[src]

Returns the total number of whole seconds in the duration.

pub fn num_milliseconds(&self) -> i64[src]

Returns the total number of whole milliseconds in the duration,

pub fn num_microseconds(&self) -> Option<i64>[src]

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

pub fn num_nanoseconds(&self) -> Option<i64>[src]

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

pub fn checked_add(&self, rhs: &Duration) -> Option<Duration>[src]

Add two durations, returning None if overflow occurred.

pub fn checked_sub(&self, rhs: &Duration) -> Option<Duration>[src]

Subtract two durations, returning None if overflow occurred.

pub fn is_zero(&self) -> bool[src]

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

pub fn to_std(&self) -> Result<Duration, OutOfRangeError>[src]

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 Clone for Duration[src]

impl Debug for Duration[src]

impl Deref for Duration[src]

type Target = Duration

The resulting type after dereferencing.

impl<'de> Deserialize<'de> for Duration[src]

impl PartialEq<Duration> for Duration[src]

impl Serialize for Duration[src]

impl StructuralPartialEq for Duration[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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

type Error = Infallible

The type returned in the event of a conversion error.

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

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.