Struct time::Duration[][src]

pub struct Duration { /* fields omitted */ }
Expand description

A span of time with nanosecond precision.

Each Duration is composed of a whole number of seconds and a fractional part represented in nanoseconds.

This implementation allows for negative durations, unlike core::time::Duration.

Implementations

impl Duration[src]

pub const ZERO: Self[src]

Equivalent to 0.seconds().

assert_eq!(Duration::ZERO, 0.seconds());
Run

pub const NANOSECOND: Self[src]

Equivalent to 1.nanoseconds().

assert_eq!(Duration::NANOSECOND, 1.nanoseconds());
Run

pub const MICROSECOND: Self[src]

Equivalent to 1.microseconds().

assert_eq!(Duration::MICROSECOND, 1.microseconds());
Run

pub const MILLISECOND: Self[src]

Equivalent to 1.milliseconds().

assert_eq!(Duration::MILLISECOND, 1.milliseconds());
Run

pub const SECOND: Self[src]

Equivalent to 1.seconds().

assert_eq!(Duration::SECOND, 1.seconds());
Run

pub const MINUTE: Self[src]

Equivalent to 1.minutes().

assert_eq!(Duration::MINUTE, 1.minutes());
Run

pub const HOUR: Self[src]

Equivalent to 1.hours().

assert_eq!(Duration::HOUR, 1.hours());
Run

pub const DAY: Self[src]

Equivalent to 1.days().

assert_eq!(Duration::DAY, 1.days());
Run

pub const WEEK: Self[src]

Equivalent to 1.weeks().

assert_eq!(Duration::WEEK, 1.weeks());
Run

pub const MIN: Self[src]

The minimum possible duration. Adding any negative duration to this will cause an overflow.

pub const MAX: Self[src]

The maximum possible duration. Adding any positive duration to this will cause an overflow.

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

Check if a duration is exactly zero.

assert!(0.seconds().is_zero());
assert!(!1.nanoseconds().is_zero());
Run

pub const fn is_negative(self) -> bool[src]

Check if a duration is negative.

assert!((-1).seconds().is_negative());
assert!(!0.seconds().is_negative());
assert!(!1.seconds().is_negative());
Run

pub const fn is_positive(self) -> bool[src]

Check if a duration is positive.

assert!(1.seconds().is_positive());
assert!(!0.seconds().is_positive());
assert!(!(-1).seconds().is_positive());
Run

pub const fn abs(self) -> Self[src]

Get the absolute value of the duration.

This method saturates the returned value if it would otherwise overflow.

assert_eq!(1.seconds().abs(), 1.seconds());
assert_eq!(0.seconds().abs(), 0.seconds());
assert_eq!((-1).seconds().abs(), 1.seconds());
Run

This feature is const fn when using rustc >= 1.47.

pub const fn new(seconds: i64, nanoseconds: i32) -> Self[src]

Create a new Duration with the provided seconds and nanoseconds. If nanoseconds is at least ±109, it will wrap to the number of seconds.

assert_eq!(Duration::new(1, 0), 1.seconds());
assert_eq!(Duration::new(-1, 0), (-1).seconds());
assert_eq!(Duration::new(1, 2_000_000_000), 3.seconds());
Run

pub const fn weeks(weeks: i64) -> Self[src]

Create a new Duration with the given number of weeks. Equivalent to Duration::seconds(weeks * 604_800).

assert_eq!(Duration::weeks(1), 604_800.seconds());
Run

pub const fn days(days: i64) -> Self[src]

Create a new Duration with the given number of days. Equivalent to Duration::seconds(days * 86_400).

assert_eq!(Duration::days(1), 86_400.seconds());
Run

pub const fn hours(hours: i64) -> Self[src]

Create a new Duration with the given number of hours. Equivalent to Duration::seconds(hours * 3_600).

assert_eq!(Duration::hours(1), 3_600.seconds());
Run

pub const fn minutes(minutes: i64) -> Self[src]

Create a new Duration with the given number of minutes. Equivalent to Duration::seconds(minutes * 60).

assert_eq!(Duration::minutes(1), 60.seconds());
Run

pub const fn seconds(seconds: i64) -> Self[src]

Create a new Duration with the given number of seconds.

assert_eq!(Duration::seconds(1), 1_000.milliseconds());
Run

pub fn seconds_f64(seconds: f64) -> Self[src]

Creates a new Duration from the specified number of seconds represented as f64.

assert_eq!(Duration::seconds_f64(0.5), 0.5.seconds());
assert_eq!(Duration::seconds_f64(-0.5), -0.5.seconds());
Run

pub fn seconds_f32(seconds: f32) -> Self[src]

Creates a new Duration from the specified number of seconds represented as f32.

assert_eq!(Duration::seconds_f32(0.5), 0.5.seconds());
assert_eq!(Duration::seconds_f32(-0.5), (-0.5).seconds());
Run

pub const fn milliseconds(milliseconds: i64) -> Self[src]

Create a new Duration with the given number of milliseconds.

assert_eq!(Duration::milliseconds(1), 1_000.microseconds());
assert_eq!(Duration::milliseconds(-1), (-1_000).microseconds());
Run

pub const fn microseconds(microseconds: i64) -> Self[src]

Create a new Duration with the given number of microseconds.

assert_eq!(Duration::microseconds(1), 1_000.nanoseconds());
assert_eq!(Duration::microseconds(-1), (-1_000).nanoseconds());
Run

pub const fn nanoseconds(nanoseconds: i64) -> Self[src]

Create a new Duration with the given number of nanoseconds.

assert_eq!(Duration::nanoseconds(1), 1.microseconds() / 1_000);
assert_eq!(Duration::nanoseconds(-1), (-1).microseconds() / 1_000);
Run

pub const fn whole_weeks(self) -> i64[src]

Get the number of whole weeks in the duration.

assert_eq!(1.weeks().whole_weeks(), 1);
assert_eq!((-1).weeks().whole_weeks(), -1);
assert_eq!(6.days().whole_weeks(), 0);
assert_eq!((-6).days().whole_weeks(), 0);
Run

pub const fn whole_days(self) -> i64[src]

Get the number of whole days in the duration.

assert_eq!(1.days().whole_days(), 1);
assert_eq!((-1).days().whole_days(), -1);
assert_eq!(23.hours().whole_days(), 0);
assert_eq!((-23).hours().whole_days(), 0);
Run

pub const fn whole_hours(self) -> i64[src]

Get the number of whole hours in the duration.

assert_eq!(1.hours().whole_hours(), 1);
assert_eq!((-1).hours().whole_hours(), -1);
assert_eq!(59.minutes().whole_hours(), 0);
assert_eq!((-59).minutes().whole_hours(), 0);
Run

pub const fn whole_minutes(self) -> i64[src]

Get the number of whole minutes in the duration.

assert_eq!(1.minutes().whole_minutes(), 1);
assert_eq!((-1).minutes().whole_minutes(), -1);
assert_eq!(59.seconds().whole_minutes(), 0);
assert_eq!((-59).seconds().whole_minutes(), 0);
Run

pub const fn whole_seconds(self) -> i64[src]

Get the number of whole seconds in the duration.

assert_eq!(1.seconds().whole_seconds(), 1);
assert_eq!((-1).seconds().whole_seconds(), -1);
assert_eq!(1.minutes().whole_seconds(), 60);
assert_eq!((-1).minutes().whole_seconds(), -60);
Run

pub fn as_seconds_f64(self) -> f64[src]

Get the number of fractional seconds in the duration.

assert_eq!(1.5.seconds().as_seconds_f64(), 1.5);
assert_eq!((-1.5).seconds().as_seconds_f64(), -1.5);
Run

pub fn as_seconds_f32(self) -> f32[src]

Get the number of fractional seconds in the duration.

assert_eq!(1.5.seconds().as_seconds_f32(), 1.5);
assert_eq!((-1.5).seconds().as_seconds_f32(), -1.5);
Run

pub const fn whole_milliseconds(self) -> i128[src]

Get the number of whole milliseconds in the duration.

assert_eq!(1.seconds().whole_milliseconds(), 1_000);
assert_eq!((-1).seconds().whole_milliseconds(), -1_000);
assert_eq!(1.milliseconds().whole_milliseconds(), 1);
assert_eq!((-1).milliseconds().whole_milliseconds(), -1);
Run

pub const fn subsec_milliseconds(self) -> i16[src]

Get the number of milliseconds past the number of whole seconds.

Always in the range -1_000..1_000.

assert_eq!(1.4.seconds().subsec_milliseconds(), 400);
assert_eq!((-1.4).seconds().subsec_milliseconds(), -400);
Run

pub const fn whole_microseconds(self) -> i128[src]

Get the number of whole microseconds in the duration.

assert_eq!(1.milliseconds().whole_microseconds(), 1_000);
assert_eq!((-1).milliseconds().whole_microseconds(), -1_000);
assert_eq!(1.microseconds().whole_microseconds(), 1);
assert_eq!((-1).microseconds().whole_microseconds(), -1);
Run

pub const fn subsec_microseconds(self) -> i32[src]

Get the number of microseconds past the number of whole seconds.

Always in the range -1_000_000..1_000_000.

assert_eq!(1.0004.seconds().subsec_microseconds(), 400);
assert_eq!((-1.0004).seconds().subsec_microseconds(), -400);
Run

pub const fn whole_nanoseconds(self) -> i128[src]

Get the number of nanoseconds in the duration.

assert_eq!(1.microseconds().whole_nanoseconds(), 1_000);
assert_eq!((-1).microseconds().whole_nanoseconds(), -1_000);
assert_eq!(1.nanoseconds().whole_nanoseconds(), 1);
assert_eq!((-1).nanoseconds().whole_nanoseconds(), -1);
Run

pub const fn subsec_nanoseconds(self) -> i32[src]

Get the number of nanoseconds past the number of whole seconds.

The returned value will always be in the range -1_000_000_000..1_000_000_000.

assert_eq!(1.000_000_400.seconds().subsec_nanoseconds(), 400);
assert_eq!((-1.000_000_400).seconds().subsec_nanoseconds(), -400);
Run

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

Computes self + rhs, returning None if an overflow occurred.

assert_eq!(5.seconds().checked_add(5.seconds()), Some(10.seconds()));
assert_eq!(Duration::MAX.checked_add(1.nanoseconds()), None);
assert_eq!((-5).seconds().checked_add(5.seconds()), Some(0.seconds()));
Run

This feature is const fn when using rustc >= 1.47.

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

Computes self - rhs, returning None if an overflow occurred.

assert_eq!(5.seconds().checked_sub(5.seconds()), Some(Duration::ZERO));
assert_eq!(Duration::MIN.checked_sub(1.nanoseconds()), None);
assert_eq!(5.seconds().checked_sub(10.seconds()), Some((-5).seconds()));
Run

This feature is const fn when using rustc >= 1.47.

pub const fn checked_mul(self, rhs: i32) -> Option<Self>[src]

Computes self * rhs, returning None if an overflow occurred.

assert_eq!(5.seconds().checked_mul(2), Some(10.seconds()));
assert_eq!(5.seconds().checked_mul(-2), Some((-10).seconds()));
assert_eq!(5.seconds().checked_mul(0), Some(0.seconds()));
assert_eq!(Duration::MAX.checked_mul(2), None);
assert_eq!(Duration::MIN.checked_mul(2), None);
Run

This feature is const fn when using rustc >= 1.47.

pub const fn checked_div(self, rhs: i32) -> Option<Self>[src]

Computes self / rhs, returning None if rhs == 0.

assert_eq!(10.seconds().checked_div(2), Some(5.seconds()));
assert_eq!(10.seconds().checked_div(-2), Some((-5).seconds()));
assert_eq!(1.seconds().checked_div(0), None);
Run

pub const fn saturating_add(self, rhs: Self) -> Self[src]

Computes self + rhs, saturating if an overflow occurred.

assert_eq!(5.seconds().saturating_add(5.seconds()), 10.seconds());
assert_eq!(Duration::MAX.saturating_add(1.nanoseconds()), Duration::MAX);
assert_eq!(
    Duration::MIN.saturating_add((-1).nanoseconds()),
    Duration::MIN
);
assert_eq!((-5).seconds().saturating_add(5.seconds()), Duration::ZERO);
Run

This feature is const fn when using rustc >= 1.47.

pub const fn saturating_sub(self, rhs: Self) -> Self[src]

Computes self - rhs, saturating if an overflow occurred.

assert_eq!(5.seconds().saturating_sub(5.seconds()), Duration::ZERO);
assert_eq!(Duration::MIN.saturating_sub(1.nanoseconds()), Duration::MIN);
assert_eq!(
    Duration::MAX.saturating_sub((-1).nanoseconds()),
    Duration::MAX
);
assert_eq!(5.seconds().saturating_sub(10.seconds()), (-5).seconds());
Run

This feature is const fn when using rustc >= 1.47.

pub const fn saturating_mul(self, rhs: i32) -> Self[src]

Computes self * rhs, saturating if an overflow occurred.

assert_eq!(5.seconds().saturating_mul(2), 10.seconds());
assert_eq!(5.seconds().saturating_mul(-2), (-10).seconds());
assert_eq!(5.seconds().saturating_mul(0), Duration::ZERO);
assert_eq!(Duration::MAX.saturating_mul(2), Duration::MAX);
assert_eq!(Duration::MIN.saturating_mul(2), Duration::MIN);
assert_eq!(Duration::MAX.saturating_mul(-2), Duration::MIN);
assert_eq!(Duration::MIN.saturating_mul(-2), Duration::MAX);
Run

This feature is const fn when using rustc >= 1.47.

pub fn time_fn<T>(f: impl FnOnce() -> T) -> (Self, T)[src]

This is supported on crate feature std only.

Runs a closure, returning the duration of time it took to run. The return value of the closure is provided in the second part of the tuple.

Trait Implementations

impl Add<Duration> for Date[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, duration: Duration) -> Self::Output[src]

Performs the + operation. Read more

impl Add<Duration> for Duration[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, rhs: Self) -> Self::Output[src]

Performs the + operation. Read more

impl Add<Duration> for Duration[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, std_duration: StdDuration) -> Self::Output[src]

Performs the + operation. Read more

impl Add<Duration> for Instant[src]

This is supported on crate feature std only.

type Output = Self

The resulting type after applying the + operator.

fn add(self, duration: Duration) -> Self::Output[src]

Performs the + operation. Read more

impl Add<Duration> for PrimitiveDateTime[src]

type Output = Self

The resulting type after applying the + operator.

fn add(self, duration: Duration) -> Self::Output[src]

Performs the + operation. Read more

impl Add<Duration> for Time[src]

fn add(self, duration: Duration) -> Self::Output[src]

Add the sub-day time of the Duration to the Time. Wraps on overflow.

assert_eq!(time!("12:00") + 2.hours(), time!("14:00"));
assert_eq!(time!("0:00:01") + (-2).seconds(), time!("23:59:59"));
Run

type Output = Self

The resulting type after applying the + operator.

impl<T> AddAssign<T> for Duration where
    Self: Add<T, Output = Self>, 
[src]

fn add_assign(&mut self, rhs: T)[src]

Performs the += operation. Read more

impl Arbitrary for Duration[src]

This is supported on crate feature quickcheck only.

fn arbitrary(g: &mut Gen) -> Self[src]

Return an arbitrary value. Read more

fn shrink(&self) -> Box<dyn Iterator<Item = Self>>[src]

Return an iterator of values that are smaller than itself. Read more

impl Clone for Duration[src]

fn clone(&self) -> Duration[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Duration[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Duration[src]

fn default() -> Duration[src]

Returns the “default value” for a type. Read more

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

This is supported on crate feature serde only.

fn deserialize<D: Deserializer<'a>>(deserializer: D) -> Result<Self, D::Error>[src]

Deserialize this value from the given Serde deserializer. Read more

impl Div<Duration> for Duration[src]

type Output = f64

The resulting type after applying the / operator.

fn div(self, rhs: Self) -> Self::Output[src]

Performs the / operation. Read more

impl Div<Duration> for Duration[src]

type Output = f64

The resulting type after applying the / operator.

fn div(self, rhs: StdDuration) -> Self::Output[src]

Performs the / operation. Read more

impl Div<f32> for Duration[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, rhs: f32) -> Self::Output[src]

Performs the / operation. Read more

impl Div<f64> for Duration[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, rhs: f64) -> Self::Output[src]

Performs the / operation. Read more

impl Div<i16> for Duration[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, rhs: i16) -> Self::Output[src]

Performs the / operation. Read more

impl Div<i32> for Duration[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, rhs: i32) -> Self::Output[src]

Performs the / operation. Read more

impl Div<i8> for Duration[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, rhs: i8) -> Self::Output[src]

Performs the / operation. Read more

impl Div<u16> for Duration[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, rhs: u16) -> Self::Output[src]

Performs the / operation. Read more

impl Div<u32> for Duration[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, rhs: u32) -> Self::Output[src]

Performs the / operation. Read more

impl Div<u8> for Duration[src]

type Output = Self

The resulting type after applying the / operator.

fn div(self, rhs: u8) -> Self::Output[src]

Performs the / operation. Read more

impl<T> DivAssign<T> for Duration where
    Self: Div<T, Output = Self>, 
[src]

fn div_assign(&mut self, rhs: T)[src]

Performs the /= operation. Read more

impl Hash for Duration[src]

fn hash<__H: Hasher>(&self, state: &mut __H)[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given Hasher. Read more

impl Mul<f32> for Duration[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, rhs: f32) -> Self::Output[src]

Performs the * operation. Read more

impl Mul<f64> for Duration[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, rhs: f64) -> Self::Output[src]

Performs the * operation. Read more

impl Mul<i16> for Duration[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, rhs: i16) -> Self::Output[src]

Performs the * operation. Read more

impl Mul<i32> for Duration[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, rhs: i32) -> Self::Output[src]

Performs the * operation. Read more

impl Mul<i8> for Duration[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, rhs: i8) -> Self::Output[src]

Performs the * operation. Read more

impl Mul<u16> for Duration[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, rhs: u16) -> Self::Output[src]

Performs the * operation. Read more

impl Mul<u32> for Duration[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, rhs: u32) -> Self::Output[src]

Performs the * operation. Read more

impl Mul<u8> for Duration[src]

type Output = Self

The resulting type after applying the * operator.

fn mul(self, rhs: u8) -> Self::Output[src]

Performs the * operation. Read more

impl<T> MulAssign<T> for Duration where
    Self: Mul<T, Output = Self>, 
[src]

fn mul_assign(&mut self, rhs: T)[src]

Performs the *= operation. Read more

impl Neg for Duration[src]

type Output = Self

The resulting type after applying the - operator.

fn neg(self) -> Self::Output[src]

Performs the unary - operation. Read more

impl Ord for Duration[src]

fn cmp(&self, other: &Duration) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<Duration> for Duration[src]

fn eq(&self, other: &Duration) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Duration) -> bool[src]

This method tests for !=.

impl PartialEq<Duration> for Duration[src]

fn eq(&self, rhs: &StdDuration) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialOrd<Duration> for Duration[src]

fn partial_cmp(&self, other: &Duration) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl PartialOrd<Duration> for Duration[src]

fn partial_cmp(&self, rhs: &StdDuration) -> Option<Ordering>[src]

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Serialize for Duration[src]

This is supported on crate feature serde only.

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>[src]

Serialize this value into the given Serde serializer. Read more

impl Sub<Duration> for Date[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, duration: Duration) -> Self::Output[src]

Performs the - operation. Read more

impl Sub<Duration> for Duration[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, rhs: Self) -> Self::Output[src]

Performs the - operation. Read more

impl Sub<Duration> for Duration[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, rhs: StdDuration) -> Self::Output[src]

Performs the - operation. Read more

impl Sub<Duration> for Instant[src]

This is supported on crate feature std only.

type Output = Self

The resulting type after applying the - operator.

fn sub(self, duration: Duration) -> Self::Output[src]

Performs the - operation. Read more

impl Sub<Duration> for PrimitiveDateTime[src]

type Output = Self

The resulting type after applying the - operator.

fn sub(self, duration: Duration) -> Self::Output[src]

Performs the - operation. Read more

impl Sub<Duration> for Time[src]

fn sub(self, duration: Duration) -> Self::Output[src]

Subtract the sub-day time of the Duration from the Time. Wraps on overflow.

assert_eq!(time!("14:00") - 2.hours(), time!("12:00"));
assert_eq!(time!("23:59:59") - (-2).seconds(), time!("0:00:01"));
Run

type Output = Self

The resulting type after applying the - operator.

impl<T> SubAssign<T> for Duration where
    Self: Sub<T, Output = Self>, 
[src]

fn sub_assign(&mut self, rhs: T)[src]

Performs the -= operation. Read more

impl TryFrom<Duration> for Duration[src]

type Error = ConversionRange

The type returned in the event of a conversion error.

fn try_from(original: StdDuration) -> Result<Self, ConversionRange>[src]

Performs the conversion.

impl Copy for Duration[src]

impl Eq for Duration[src]

impl StructuralEq for Duration[src]

impl StructuralPartialEq for Duration[src]

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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