[−][src]Struct time::Duration
A span of time with nanosecond precision.
Each Duration
is composed of a whole number of seconds and a fractional
part represented in nanoseconds.
Duration
implements many traits, including Add
, Sub
, Mul
, and
Div
, among others.
This implementation allows for negative durations, unlike
core::time::Duration
.
Methods
impl Duration
[src]
pub const fn zero() -> Self
[src]
Equivalent to Duration::seconds(0)
.
assert_eq!(Duration::zero(), Duration::seconds(0));
pub const fn nanosecond() -> Self
[src]
Equivalent to Duration::nanoseconds(1)
.
assert_eq!(Duration::nanosecond(), Duration::nanoseconds(1));
pub const fn microsecond() -> Self
[src]
Equivalent to Duration::microseconds(1)
.
assert_eq!(Duration::microsecond(), Duration::microseconds(1));
pub const fn millisecond() -> Self
[src]
Equivalent to Duration::milliseconds(1)
.
assert_eq!(Duration::millisecond(), Duration::milliseconds(1));
pub const fn second() -> Self
[src]
Equivalent to Duration::seconds(1)
.
assert_eq!(Duration::second(), Duration::seconds(1));
pub const fn minute() -> Self
[src]
Equivalent to Duration::minutes(1)
.
assert_eq!(Duration::minute(), Duration::minutes(1));
pub const fn hour() -> Self
[src]
Equivalent to Duration::hours(1)
.
assert_eq!(Duration::hour(), Duration::hours(1));
pub const fn day() -> Self
[src]
Equivalent to Duration::days(1)
.
assert_eq!(Duration::day(), Duration::days(1));
pub const fn week() -> Self
[src]
Equivalent to Duration::weeks(1)
.
assert_eq!(Duration::week(), Duration::weeks(1));
pub const fn max_value() -> Self
[src]
The maximum possible duration. Adding any positive duration to this will cause an overflow.
The value returned by this method may change at any time.
pub const fn min_value() -> Self
[src]
The minimum possible duration. Adding any negative duration to this will cause an overflow.
The value returned by this method may change at any time.
pub const fn is_zero(self) -> bool
[src]
Check if a duration is exactly zero.
assert!(Duration::seconds(0).is_zero()); assert!(!Duration::nanoseconds(1).is_zero());
pub const fn is_negative(self) -> bool
[src]
Check if a duration is negative.
assert!(Duration::seconds(-1).is_negative()); assert!(!Duration::seconds(0).is_negative()); assert!(!Duration::seconds(1).is_negative());
pub const fn is_positive(self) -> bool
[src]
Check if a duration is positive.
assert!(Duration::seconds(1).is_positive()); assert!(!Duration::seconds(0).is_positive()); assert!(!Duration::seconds(-1).is_positive());
pub fn sign(self) -> Sign
[src]
To obtain the sign of a Duration
, you should use the is_positive
, is_negative
, and is_zero
methods.
Get the sign of the duration.
assert_eq!(Duration::seconds(1).sign(), Sign::Positive); assert_eq!(Duration::seconds(-1).sign(), Sign::Negative); assert_eq!(Duration::zero().sign(), Sign::Zero);
pub const fn abs(self) -> Self
[src]
Get the absolute value of the duration.
assert_eq!(Duration::seconds(1).abs(), Duration::seconds(1)); assert_eq!(Duration::zero().abs(), Duration::zero()); assert_eq!(Duration::seconds(-1).abs(), Duration::seconds(1));
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), Duration::seconds(1)); assert_eq!(Duration::new(-1, 0), Duration::seconds(-1)); assert_eq!(Duration::new(1, 2_000_000_000), Duration::seconds(3));
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), Duration::seconds(604_800));
pub const fn whole_weeks(self) -> i64
[src]
Get the number of whole weeks in the duration.
assert_eq!(Duration::weeks(1).whole_weeks(), 1); assert_eq!(Duration::weeks(-1).whole_weeks(), -1); assert_eq!(Duration::days(6).whole_weeks(), 0); assert_eq!(Duration::days(-6).whole_weeks(), 0);
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), Duration::seconds(86_400));
pub const fn whole_days(self) -> i64
[src]
Get the number of whole days in the duration.
assert_eq!(Duration::days(1).whole_days(), 1); assert_eq!(Duration::days(-1).whole_days(), -1); assert_eq!(Duration::hours(23).whole_days(), 0); assert_eq!(Duration::hours(-23).whole_days(), 0);
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), Duration::seconds(3_600));
pub const fn whole_hours(self) -> i64
[src]
Get the number of whole hours in the duration.
assert_eq!(Duration::hours(1).whole_hours(), 1); assert_eq!(Duration::hours(-1).whole_hours(), -1); assert_eq!(Duration::minutes(59).whole_hours(), 0); assert_eq!(Duration::minutes(-59).whole_hours(), 0);
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), Duration::seconds(60));
pub const fn whole_minutes(self) -> i64
[src]
Get the number of whole minutes in the duration.
assert_eq!(Duration::minutes(1).whole_minutes(), 1); assert_eq!(Duration::minutes(-1).whole_minutes(), -1); assert_eq!(Duration::seconds(59).whole_minutes(), 0); assert_eq!(Duration::seconds(-59).whole_minutes(), 0);
pub const fn seconds(seconds: i64) -> Self
[src]
Create a new Duration
with the given number of seconds.
assert_eq!(Duration::seconds(1), Duration::milliseconds(1_000));
pub const fn whole_seconds(self) -> i64
[src]
Get the number of whole seconds in the duration.
assert_eq!(Duration::seconds(1).whole_seconds(), 1); assert_eq!(Duration::seconds(-1).whole_seconds(), -1); assert_eq!(Duration::minutes(1).whole_seconds(), 60); assert_eq!(Duration::minutes(-1).whole_seconds(), -60);
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), Duration::milliseconds(500)); assert_eq!(Duration::seconds_f64(-0.5), Duration::milliseconds(-500));
pub fn as_seconds_f64(self) -> f64
[src]
Get the number of fractional seconds in the duration.
assert_eq!(Duration::milliseconds(1_500).as_seconds_f64(), 1.5); assert_eq!(Duration::milliseconds(-1_500).as_seconds_f64(), -1.5);
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), Duration::milliseconds(500)); assert_eq!(Duration::seconds_f32(-0.5), Duration::milliseconds(-500));
pub fn as_seconds_f32(self) -> f32
[src]
Get the number of fractional seconds in the duration.
assert_eq!(Duration::milliseconds(1_500).as_seconds_f32(), 1.5); assert_eq!(Duration::milliseconds(-1_500).as_seconds_f32(), -1.5);
pub const fn milliseconds(milliseconds: i64) -> Self
[src]
Create a new Duration
with the given number of milliseconds.
assert_eq!(Duration::milliseconds(1), Duration::seconds(1) / 1_000); assert_eq!(Duration::milliseconds(-1), Duration::seconds(-1) / 1_000);
pub const fn whole_milliseconds(self) -> i128
[src]
Get the number of whole milliseconds in the duration.
assert_eq!(Duration::seconds(1).whole_milliseconds(), 1_000); assert_eq!(Duration::seconds(-1).whole_milliseconds(), -1_000); assert_eq!(Duration::milliseconds(1).whole_milliseconds(), 1); assert_eq!(Duration::milliseconds(-1).whole_milliseconds(), -1);
pub const fn subsec_milliseconds(self) -> i16
[src]
Get the number of milliseconds past the number of whole seconds.
Always in the range 0..1_000
.
assert_eq!(Duration::milliseconds(1_400).subsec_milliseconds(), 400); assert_eq!(Duration::milliseconds(-1_400).subsec_milliseconds(), -400);
pub const fn microseconds(microseconds: i64) -> Self
[src]
Create a new Duration
with the given number of microseconds.
assert_eq!(Duration::microseconds(1), Duration::seconds(1) / 1_000_000); assert_eq!( Duration::microseconds(-1), Duration::seconds(-1) / 1_000_000 );
pub const fn whole_microseconds(self) -> i128
[src]
Get the number of whole microseconds in the duration.
assert_eq!(Duration::milliseconds(1).whole_microseconds(), 1_000); assert_eq!(Duration::milliseconds(-1).whole_microseconds(), -1_000); assert_eq!(Duration::microseconds(1).whole_microseconds(), 1); assert_eq!(Duration::microseconds(-1).whole_microseconds(), -1);
pub const fn subsec_microseconds(self) -> i32
[src]
Get the number of microseconds past the number of whole seconds.
Always in the range 0..1_000_000
.
assert_eq!(Duration::microseconds(1_000_400).subsec_microseconds(), 400); assert_eq!( Duration::microseconds(-1_000_400).subsec_microseconds(), -400 );
pub const fn nanoseconds(nanoseconds: i64) -> Self
[src]
Create a new Duration
with the given number of nanoseconds.
assert_eq!( Duration::nanoseconds(1), Duration::seconds(1) / 1_000_000_000 ); assert_eq!( Duration::nanoseconds(-1), Duration::seconds(-1) / 1_000_000_000 );
pub const fn whole_nanoseconds(self) -> i128
[src]
Get the number of nanoseconds in the duration.
assert_eq!(Duration::microseconds(1).whole_nanoseconds(), 1_000); assert_eq!(Duration::microseconds(-1).whole_nanoseconds(), -1_000); assert_eq!(Duration::nanoseconds(1).whole_nanoseconds(), 1); assert_eq!(Duration::nanoseconds(-1).whole_nanoseconds(), -1);
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 0..1_000_000_000
.
assert_eq!( Duration::nanoseconds(1_000_000_400).subsec_nanoseconds(), 400 ); assert_eq!( Duration::nanoseconds(-1_000_000_400).subsec_nanoseconds(), -400 );
pub fn checked_add(self, rhs: Self) -> Option<Self>
[src]
Computes self + rhs
, returning None
if an overflow occurred.
assert_eq!( Duration::seconds(5).checked_add(Duration::seconds(5)), Some(Duration::seconds(10)) ); assert_eq!( Duration::max_value().checked_add(Duration::nanosecond()), None ); assert_eq!( Duration::seconds(-5).checked_add(Duration::seconds(5)), Some(Duration::zero()) );
pub fn checked_sub(self, rhs: Self) -> Option<Self>
[src]
Computes self - rhs
, returning None
if an overflow occurred.
assert_eq!( Duration::seconds(5).checked_sub(Duration::seconds(5)), Some(Duration::zero()) ); assert_eq!( Duration::min_value().checked_sub(Duration::nanosecond()), None ); assert_eq!( Duration::seconds(5).checked_sub(Duration::seconds(10)), Some(Duration::seconds(-5)) );
pub fn checked_mul(self, rhs: i32) -> Option<Self>
[src]
Computes self * rhs
, returning None
if an overflow occurred.
assert_eq!( Duration::seconds(5).checked_mul(2), Some(Duration::seconds(10)) ); assert_eq!( Duration::seconds(5).checked_mul(-2), Some(Duration::seconds(-10)) ); assert_eq!(Duration::seconds(5).checked_mul(0), Some(Duration::zero())); assert_eq!(Duration::max_value().checked_mul(2), None); assert_eq!(Duration::min_value().checked_mul(2), None);
pub fn checked_div(self, rhs: i32) -> Option<Self>
[src]
Computes self / rhs
, returning None
if rhs == 0
.
assert_eq!(Duration::seconds(10).checked_div(2), Some(Duration::seconds(5))); assert_eq!(Duration::seconds(10).checked_div(-2), Some(Duration::seconds(-5))); assert_eq!(Duration::seconds(1).checked_div(0), None);
pub fn time_fn<T>(f: impl FnOnce() -> T) -> (Self, T)
[src]
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.
impl Duration
[src]
Functions that have been renamed or had signatures changed since v0.1. As such, they are deprecated.
pub fn num_weeks(&self) -> i64
[src]
Use the whole_weeks
function
pub fn num_days(&self) -> i64
[src]
Use the whole_days
function
pub fn num_hours(&self) -> i64
[src]
Use the whole_hours
function
pub fn num_minutes(&self) -> i64
[src]
Use the whole_minutes
function
pub fn num_seconds(&self) -> i64
[src]
Use the whole_seconds
function
pub fn num_milliseconds(&self) -> i64
[src]
Use the whole_milliseconds
function. The value is clamped between i64::min_value()
and i64::max_value()
.
Duration::whole_milliseconds
returns an i128
, rather than
panicking on overflow. To avoid panicking, this method currently limits
the value to the range i64::min_value()..=i64::max_value()
.
pub fn num_microseconds(&self) -> Option<i64>
[src]
Use the whole_microseconds
function
Duration::whole_microseconds
returns an i128
rather than returning
None
on i64
overflow.
pub fn num_nanoseconds(&self) -> Option<i64>
[src]
Use the whole_nanoseconds
function
Duration::whole_nanoseconds
returns an i128
rather than returning
None
on i64
overflow.
pub fn span<F: FnOnce()>(f: F) -> Self
[src]
Use the time_fn
function
pub fn from_std(std: StdDuration) -> Result<Self, ConversionRangeError>
[src]
Use Duration::try_from(value)
or value.try_into()
pub fn to_std(&self) -> Result<StdDuration, ConversionRangeError>
[src]
Use std::time::Duration::try_from(value)
or value.try_into()
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]
impl Add<Duration> for Duration
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Self::Output
[src]
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]
impl Add<Duration> for StdDuration
[src]
type Output = Duration
The resulting type after applying the +
operator.
fn add(self, rhs: Duration) -> Self::Output
[src]
impl Add<Duration> for Instant
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, duration: Duration) -> Self::Output
[src]
impl Add<Duration> for StdInstant
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, duration: Duration) -> Self::Output
[src]
impl Add<Duration> for OffsetDateTime
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, duration: Duration) -> Self::Output
[src]
impl Add<Duration> for SystemTime
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, duration: Duration) -> Self::Output
[src]
impl Add<Duration> for PrimitiveDateTime
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, duration: Duration) -> Self::Output
[src]
impl Add<Duration> for Time
[src]
type Output = Self
The resulting type after applying the +
operator.
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) + Duration::hours(2), time!(14:00) ); assert_eq!( time!(0:00:01) + Duration::seconds(-2), time!(23:59:59) );
impl AddAssign<Duration> for Date
[src]
fn add_assign(&mut self, duration: Duration)
[src]
impl AddAssign<Duration> for Duration
[src]
fn add_assign(&mut self, rhs: Self)
[src]
impl AddAssign<Duration> for Duration
[src]
fn add_assign(&mut self, rhs: StdDuration)
[src]
impl AddAssign<Duration> for Instant
[src]
fn add_assign(&mut self, duration: Duration)
[src]
impl AddAssign<Duration> for StdInstant
[src]
fn add_assign(&mut self, duration: Duration)
[src]
impl AddAssign<Duration> for OffsetDateTime
[src]
fn add_assign(&mut self, duration: Duration)
[src]
impl AddAssign<Duration> for SystemTime
[src]
fn add_assign(&mut self, duration: Duration)
[src]
impl AddAssign<Duration> for PrimitiveDateTime
[src]
fn add_assign(&mut self, duration: Duration)
[src]
impl AddAssign<Duration> for Time
[src]
fn add_assign(&mut self, duration: Duration)
[src]
Add the sub-day time of the Duration
to the existing Time
. Wraps on
overflow.
let mut time = time!(12:00); time += Duration::hours(2); assert_eq!(time, time!(14:00)); let mut time = time!(0:00:01); time += Duration::seconds(-2); assert_eq!(time, time!(23:59:59));
impl Clone for Duration
[src]
impl Copy for Duration
[src]
impl Debug for Duration
[src]
impl Default for Duration
[src]
impl<'de> Deserialize<'de> for Duration
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Distribution<Duration> for Standard
[src]
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Duration
[src]
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T> where
R: Rng,
[src]
R: Rng,
impl Div<Duration> for Duration
[src]
type Output = f64
The resulting type after applying the /
operator.
fn div(self, rhs: Self) -> Self::Output
[src]
impl Div<Duration> for Duration
[src]
type Output = f64
The resulting type after applying the /
operator.
fn div(self, rhs: StdDuration) -> Self::Output
[src]
impl Div<Duration> for StdDuration
[src]
type Output = f64
The resulting type after applying the /
operator.
fn div(self, rhs: Duration) -> Self::Output
[src]
impl Div<f32> for Duration
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: f32) -> Self::Output
[src]
impl Div<f64> for Duration
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: f64) -> Self::Output
[src]
impl Div<i16> for Duration
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: i16) -> Self::Output
[src]
impl Div<i32> for Duration
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: i32) -> Self::Output
[src]
impl Div<i8> for Duration
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: i8) -> Self::Output
[src]
impl Div<u16> for Duration
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: u16) -> Self::Output
[src]
impl Div<u32> for Duration
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: u32) -> Self::Output
[src]
impl Div<u8> for Duration
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, rhs: u8) -> Self::Output
[src]
impl DivAssign<f32> for Duration
[src]
fn div_assign(&mut self, rhs: f32)
[src]
impl DivAssign<f64> for Duration
[src]
fn div_assign(&mut self, rhs: f64)
[src]
impl DivAssign<i16> for Duration
[src]
fn div_assign(&mut self, rhs: i16)
[src]
impl DivAssign<i32> for Duration
[src]
fn div_assign(&mut self, rhs: i32)
[src]
impl DivAssign<i8> for Duration
[src]
fn div_assign(&mut self, rhs: i8)
[src]
impl DivAssign<u16> for Duration
[src]
fn div_assign(&mut self, rhs: u16)
[src]
impl DivAssign<u32> for Duration
[src]
fn div_assign(&mut self, rhs: u32)
[src]
impl DivAssign<u8> for Duration
[src]
fn div_assign(&mut self, rhs: u8)
[src]
impl Eq for Duration
[src]
impl Hash for Duration
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Mul<Duration> for i8
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, rhs: Duration) -> Self::Output
[src]
impl Mul<Duration> for i16
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, rhs: Duration) -> Self::Output
[src]
impl Mul<Duration> for i32
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, rhs: Duration) -> Self::Output
[src]
impl Mul<Duration> for u8
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, rhs: Duration) -> Self::Output
[src]
impl Mul<Duration> for u16
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, rhs: Duration) -> Self::Output
[src]
impl Mul<Duration> for u32
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, rhs: Duration) -> Self::Output
[src]
impl Mul<Duration> for f32
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, rhs: Duration) -> Self::Output
[src]
impl Mul<Duration> for f64
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, rhs: Duration) -> Self::Output
[src]
impl Mul<f32> for Duration
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Self::Output
[src]
impl Mul<f64> for Duration
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: f64) -> Self::Output
[src]
impl Mul<i16> for Duration
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: i16) -> Self::Output
[src]
impl Mul<i32> for Duration
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: i32) -> Self::Output
[src]
impl Mul<i8> for Duration
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: i8) -> Self::Output
[src]
impl Mul<u16> for Duration
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: u16) -> Self::Output
[src]
impl Mul<u32> for Duration
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: u32) -> Self::Output
[src]
impl Mul<u8> for Duration
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, rhs: u8) -> Self::Output
[src]
impl MulAssign<f32> for Duration
[src]
fn mul_assign(&mut self, rhs: f32)
[src]
impl MulAssign<f64> for Duration
[src]
fn mul_assign(&mut self, rhs: f64)
[src]
impl MulAssign<i16> for Duration
[src]
fn mul_assign(&mut self, rhs: i16)
[src]
impl MulAssign<i32> for Duration
[src]
fn mul_assign(&mut self, rhs: i32)
[src]
impl MulAssign<i8> for Duration
[src]
fn mul_assign(&mut self, rhs: i8)
[src]
impl MulAssign<u16> for Duration
[src]
fn mul_assign(&mut self, rhs: u16)
[src]
impl MulAssign<u32> for Duration
[src]
fn mul_assign(&mut self, rhs: u32)
[src]
impl MulAssign<u8> for Duration
[src]
fn mul_assign(&mut self, rhs: u8)
[src]
impl Neg for Duration
[src]
type Output = Self
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
impl Ord for Duration
[src]
fn cmp(&self, rhs: &Self) -> Ordering
[src]
#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Duration> for Duration
[src]
impl PartialEq<Duration> for Duration
[src]
impl PartialEq<Duration> for StdDuration
[src]
impl PartialOrd<Duration> for Duration
[src]
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Duration> for Duration
[src]
fn partial_cmp(&self, rhs: &StdDuration) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialOrd<Duration> for StdDuration
[src]
fn partial_cmp(&self, rhs: &Duration) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for Duration
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for Duration
[src]
impl StructuralPartialEq for Duration
[src]
impl Sub<Duration> for Date
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, duration: Duration) -> Self::Output
[src]
impl Sub<Duration> for Duration
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Self::Output
[src]
impl Sub<Duration> for Duration
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, rhs: StdDuration) -> Self::Output
[src]
impl Sub<Duration> for StdDuration
[src]
type Output = Duration
The resulting type after applying the -
operator.
fn sub(self, rhs: Duration) -> Self::Output
[src]
impl Sub<Duration> for Instant
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, duration: Duration) -> Self::Output
[src]
impl Sub<Duration> for StdInstant
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, duration: Duration) -> Self::Output
[src]
impl Sub<Duration> for OffsetDateTime
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, duration: Duration) -> Self::Output
[src]
impl Sub<Duration> for SystemTime
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, duration: Duration) -> Self::Output
[src]
impl Sub<Duration> for PrimitiveDateTime
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, duration: Duration) -> Self::Output
[src]
impl Sub<Duration> for Time
[src]
type Output = Self
The resulting type after applying the -
operator.
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) - Duration::hours(2), time!(12:00) ); assert_eq!( time!(23:59:59) - Duration::seconds(-2), time!(0:00:01) );
impl SubAssign<Duration> for Date
[src]
fn sub_assign(&mut self, duration: Duration)
[src]
impl SubAssign<Duration> for Duration
[src]
fn sub_assign(&mut self, rhs: Self)
[src]
impl SubAssign<Duration> for Duration
[src]
fn sub_assign(&mut self, rhs: StdDuration)
[src]
impl SubAssign<Duration> for StdDuration
[src]
fn sub_assign(&mut self, rhs: Duration)
[src]
impl SubAssign<Duration> for Instant
[src]
fn sub_assign(&mut self, duration: Duration)
[src]
impl SubAssign<Duration> for StdInstant
[src]
fn sub_assign(&mut self, duration: Duration)
[src]
impl SubAssign<Duration> for OffsetDateTime
[src]
fn sub_assign(&mut self, duration: Duration)
[src]
impl SubAssign<Duration> for SystemTime
[src]
fn sub_assign(&mut self, duration: Duration)
[src]
impl SubAssign<Duration> for PrimitiveDateTime
[src]
fn sub_assign(&mut self, duration: Duration)
[src]
impl SubAssign<Duration> for Time
[src]
fn sub_assign(&mut self, duration: Duration)
[src]
Subtract the sub-day time of the Duration
from the existing Time
.
Wraps on overflow.
let mut time = time!(14:00); time -= Duration::hours(2); assert_eq!(time, time!(12:00)); let mut time = time!(23:59:59); time -= Duration::seconds(-2); assert_eq!(time, time!(0:00:01));
impl TryFrom<Duration> for Duration
[src]
type Error = ConversionRangeError
The type returned in the event of a conversion error.
fn try_from(original: StdDuration) -> Result<Self, ConversionRangeError>
[src]
impl TryFrom<Duration> for StdDuration
[src]
type Error = ConversionRangeError
The type returned in the event of a conversion error.
fn try_from(duration: Duration) -> Result<Self, ConversionRangeError>
[src]
Auto Trait Implementations
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,