Expand description
Represents a duration of time.
The generic T
can either be u32
or u64
, and the const generics represent the ratio of the
ticks contained within the duration: duration in seconds = NOM / DENOM * ticks
Implementations
impl<const NOM: u32, const DENOM: u32> Duration<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> Duration<u32, NOM, DENOM>
pub const fn from_ticks(ticks: u32) -> Duration<u32, NOM, DENOM>
pub const fn from_ticks(ticks: u32) -> Duration<u32, NOM, DENOM>
Create a Duration
from a ticks value.
let _d = Duration::<u32, 1, 1_000>::from_ticks(1);
pub const fn ticks(&self) -> u32
pub const fn ticks(&self) -> u32
Extract the ticks from a Duration
.
let d = Duration::<u32, 1, 1_000>::from_ticks(234);
assert_eq!(d.ticks(), 234);
pub const fn checked_add<const O_NOM: u32, const O_DENOM: u32>(
self,
other: Duration<u32, O_NOM, O_DENOM>
) -> Option<Duration<u32, NOM, DENOM>>
pub const fn checked_add<const O_NOM: u32, const O_DENOM: u32>(
self,
other: Duration<u32, O_NOM, O_DENOM>
) -> Option<Duration<u32, NOM, DENOM>>
Add two durations while checking for overflow.
let d1 = Duration::<u32, 1, 1_000>::from_ticks(1);
let d2 = Duration::<u32, 1, 1_000>::from_ticks(2);
let d3 = Duration::<u32, 1, 1_000>::from_ticks(u32::MAX);
assert_eq!(d1.checked_add(d2).unwrap().ticks(), 3);
assert_eq!(d1.checked_add(d3), None);
pub const fn checked_sub<const O_NOM: u32, const O_DENOM: u32>(
self,
other: Duration<u32, O_NOM, O_DENOM>
) -> Option<Duration<u32, NOM, DENOM>>
pub const fn checked_sub<const O_NOM: u32, const O_DENOM: u32>(
self,
other: Duration<u32, O_NOM, O_DENOM>
) -> Option<Duration<u32, NOM, DENOM>>
Subtract two durations while checking for overflow.
let d1 = Duration::<u32, 1, 1_000>::from_ticks(1);
let d2 = Duration::<u32, 1, 1_000>::from_ticks(2);
let d3 = Duration::<u32, 1, 1_000>::from_ticks(u32::MAX);
assert_eq!(d2.checked_sub(d1).unwrap().ticks(), 1);
assert_eq!(d1.checked_sub(d3), None);
pub const fn const_partial_cmp<const R_NOM: u32, const R_DENOM: u32>(
self,
other: Duration<u32, R_NOM, R_DENOM>
) -> Option<Ordering>
pub const fn const_partial_cmp<const R_NOM: u32, const R_DENOM: u32>(
self,
other: Duration<u32, R_NOM, R_DENOM>
) -> Option<Ordering>
Const partial comparison.
let d1 = Duration::<u32, 1, 1_00>::from_ticks(1);
let d2 = Duration::<u32, 1, 1_000>::from_ticks(1);
assert_eq!(d1.const_partial_cmp(d2), Some(core::cmp::Ordering::Greater));
pub const fn const_eq<const R_NOM: u32, const R_DENOM: u32>(
self,
other: Duration<u32, R_NOM, R_DENOM>
) -> bool
pub const fn const_eq<const R_NOM: u32, const R_DENOM: u32>(
self,
other: Duration<u32, R_NOM, R_DENOM>
) -> bool
Const equality check.
let d1 = Duration::<u32, 1, 1_00>::from_ticks(1);
let d2 = Duration::<u32, 1, 1_000>::from_ticks(10);
assert!(d1.const_eq(d2));
pub const fn const_try_into<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Option<Duration<u32, O_NOM, O_DENOM>>
pub const fn const_try_into<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Option<Duration<u32, O_NOM, O_DENOM>>
Const try into, checking for overflow.
let d1 = Duration::<u32, 1, 1_00>::from_ticks(1);
let d2: Option<Duration::<u32, 1, 1_000>> = d1.const_try_into();
assert_eq!(d2.unwrap().ticks(), 10);
pub const fn try_into_rate<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Option<Rate<u32, O_NOM, O_DENOM>>
pub const fn try_into_rate<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Option<Rate<u32, O_NOM, O_DENOM>>
Const try into rate, checking for divide-by-zero.
let d1 = Duration::<u32, 1, 1_000>::from_ticks(2);
let r1: Option<Rate::<u32, 1, 1>> = d1.try_into_rate();
assert_eq!(r1.unwrap().raw(), 500);
pub const fn into_rate<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Rate<u32, O_NOM, O_DENOM>
pub const fn into_rate<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Rate<u32, O_NOM, O_DENOM>
Convert from duration to rate.
pub const fn convert<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Duration<u32, O_NOM, O_DENOM>
pub const fn convert<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Duration<u32, O_NOM, O_DENOM>
Convert between bases for a duration.
Unfortunately not a From
impl due to collision with the std lib.
let d1 = Duration::<u32, 1, 100>::from_ticks(1);
let d2: Duration::<u32, 1, 1_000> = d1.convert();
assert_eq!(d2.ticks(), 10);
Can be used in const contexts. Compilation will fail if the conversion causes overflow
const TICKS: u32= u32::MAX - 10;
const D1: Duration::<u32, 1, 100> = Duration::<u32, 1, 100>::from_ticks(TICKS);
// Fails conversion due to tick overflow
const D2: Duration::<u32, 1, 200> = D1.convert();
pub const fn to_minutes(&self) -> u32
pub const fn to_minutes(&self) -> u32
Convert the Duration to an integer number of minutes.
pub const fn nanos(val: u32) -> Duration<u32, NOM, DENOM>
pub const fn nanos(val: u32) -> Duration<u32, NOM, DENOM>
Shorthand for creating a duration which represents nanoseconds.
pub const fn micros(val: u32) -> Duration<u32, NOM, DENOM>
pub const fn micros(val: u32) -> Duration<u32, NOM, DENOM>
Shorthand for creating a duration which represents microseconds.
pub const fn millis(val: u32) -> Duration<u32, NOM, DENOM>
pub const fn millis(val: u32) -> Duration<u32, NOM, DENOM>
Shorthand for creating a duration which represents milliseconds.
pub const fn secs(val: u32) -> Duration<u32, NOM, DENOM>
pub const fn secs(val: u32) -> Duration<u32, NOM, DENOM>
Shorthand for creating a duration which represents seconds.
impl<const NOM: u32, const DENOM: u32> Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> Duration<u64, NOM, DENOM>
pub const fn from_ticks(ticks: u64) -> Duration<u64, NOM, DENOM>
pub const fn from_ticks(ticks: u64) -> Duration<u64, NOM, DENOM>
Create a Duration
from a ticks value.
let _d = Duration::<u64, 1, 1_000>::from_ticks(1);
pub const fn ticks(&self) -> u64
pub const fn ticks(&self) -> u64
Extract the ticks from a Duration
.
let d = Duration::<u64, 1, 1_000>::from_ticks(234);
assert_eq!(d.ticks(), 234);
pub const fn checked_add<const O_NOM: u32, const O_DENOM: u32>(
self,
other: Duration<u64, O_NOM, O_DENOM>
) -> Option<Duration<u64, NOM, DENOM>>
pub const fn checked_add<const O_NOM: u32, const O_DENOM: u32>(
self,
other: Duration<u64, O_NOM, O_DENOM>
) -> Option<Duration<u64, NOM, DENOM>>
Add two durations while checking for overflow.
let d1 = Duration::<u64, 1, 1_000>::from_ticks(1);
let d2 = Duration::<u64, 1, 1_000>::from_ticks(2);
let d3 = Duration::<u64, 1, 1_000>::from_ticks(u64::MAX);
assert_eq!(d1.checked_add(d2).unwrap().ticks(), 3);
assert_eq!(d1.checked_add(d3), None);
pub const fn checked_sub<const O_NOM: u32, const O_DENOM: u32>(
self,
other: Duration<u64, O_NOM, O_DENOM>
) -> Option<Duration<u64, NOM, DENOM>>
pub const fn checked_sub<const O_NOM: u32, const O_DENOM: u32>(
self,
other: Duration<u64, O_NOM, O_DENOM>
) -> Option<Duration<u64, NOM, DENOM>>
Subtract two durations while checking for overflow.
let d1 = Duration::<u64, 1, 1_000>::from_ticks(1);
let d2 = Duration::<u64, 1, 1_000>::from_ticks(2);
let d3 = Duration::<u64, 1, 1_000>::from_ticks(u64::MAX);
assert_eq!(d2.checked_sub(d1).unwrap().ticks(), 1);
assert_eq!(d1.checked_sub(d3), None);
pub const fn const_partial_cmp<const R_NOM: u32, const R_DENOM: u32>(
self,
other: Duration<u64, R_NOM, R_DENOM>
) -> Option<Ordering>
pub const fn const_partial_cmp<const R_NOM: u32, const R_DENOM: u32>(
self,
other: Duration<u64, R_NOM, R_DENOM>
) -> Option<Ordering>
Const partial comparison.
let d1 = Duration::<u64, 1, 1_00>::from_ticks(1);
let d2 = Duration::<u64, 1, 1_000>::from_ticks(1);
assert_eq!(d1.const_partial_cmp(d2), Some(core::cmp::Ordering::Greater));
pub const fn const_eq<const R_NOM: u32, const R_DENOM: u32>(
self,
other: Duration<u64, R_NOM, R_DENOM>
) -> bool
pub const fn const_eq<const R_NOM: u32, const R_DENOM: u32>(
self,
other: Duration<u64, R_NOM, R_DENOM>
) -> bool
Const equality check.
let d1 = Duration::<u64, 1, 1_00>::from_ticks(1);
let d2 = Duration::<u64, 1, 1_000>::from_ticks(10);
assert!(d1.const_eq(d2));
pub const fn const_try_into<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Option<Duration<u64, O_NOM, O_DENOM>>
pub const fn const_try_into<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Option<Duration<u64, O_NOM, O_DENOM>>
Const try into, checking for overflow.
let d1 = Duration::<u64, 1, 1_00>::from_ticks(1);
let d2: Option<Duration::<u64, 1, 1_000>> = d1.const_try_into();
assert_eq!(d2.unwrap().ticks(), 10);
pub const fn try_into_rate<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Option<Rate<u64, O_NOM, O_DENOM>>
pub const fn try_into_rate<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Option<Rate<u64, O_NOM, O_DENOM>>
Const try into rate, checking for divide-by-zero.
let d1 = Duration::<u64, 1, 1_000>::from_ticks(2);
let r1: Option<Rate::<u64, 1, 1>> = d1.try_into_rate();
assert_eq!(r1.unwrap().raw(), 500);
pub const fn into_rate<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Rate<u64, O_NOM, O_DENOM>
pub const fn into_rate<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Rate<u64, O_NOM, O_DENOM>
Convert from duration to rate.
pub const fn convert<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Duration<u64, O_NOM, O_DENOM>
pub const fn convert<const O_NOM: u32, const O_DENOM: u32>(
self
) -> Duration<u64, O_NOM, O_DENOM>
Convert between bases for a duration.
Unfortunately not a From
impl due to collision with the std lib.
let d1 = Duration::<u64, 1, 100>::from_ticks(1);
let d2: Duration::<u64, 1, 1_000> = d1.convert();
assert_eq!(d2.ticks(), 10);
Can be used in const contexts. Compilation will fail if the conversion causes overflow
const TICKS: u64= u64::MAX - 10;
const D1: Duration::<u64, 1, 100> = Duration::<u64, 1, 100>::from_ticks(TICKS);
// Fails conversion due to tick overflow
const D2: Duration::<u64, 1, 200> = D1.convert();
pub const fn to_minutes(&self) -> u64
pub const fn to_minutes(&self) -> u64
Convert the Duration to an integer number of minutes.
pub const fn nanos(val: u64) -> Duration<u64, NOM, DENOM>
pub const fn nanos(val: u64) -> Duration<u64, NOM, DENOM>
Shorthand for creating a duration which represents nanoseconds.
pub const fn micros(val: u64) -> Duration<u64, NOM, DENOM>
pub const fn micros(val: u64) -> Duration<u64, NOM, DENOM>
Shorthand for creating a duration which represents microseconds.
pub const fn millis(val: u64) -> Duration<u64, NOM, DENOM>
pub const fn millis(val: u64) -> Duration<u64, NOM, DENOM>
Shorthand for creating a duration which represents milliseconds.
pub const fn secs(val: u64) -> Duration<u64, NOM, DENOM>
pub const fn secs(val: u64) -> Duration<u64, NOM, DENOM>
Shorthand for creating a duration which represents seconds.
Trait Implementations
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u32, NOM, DENOM>> for Duration<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u32, NOM, DENOM>> for Duration<u32, NOM, DENOM>
fn add_assign(&mut self, other: Duration<u32, NOM, DENOM>)
fn add_assign(&mut self, other: Duration<u32, NOM, DENOM>)
Performs the +=
operation. Read more
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u32, NOM, DENOM>> for Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u32, NOM, DENOM>> for Duration<u64, NOM, DENOM>
fn add_assign(&mut self, other: Duration<u32, NOM, DENOM>)
fn add_assign(&mut self, other: Duration<u32, NOM, DENOM>)
Performs the +=
operation. Read more
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u32, NOM, DENOM>> for Instant<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u32, NOM, DENOM>> for Instant<u32, NOM, DENOM>
fn add_assign(&mut self, other: Duration<u32, NOM, DENOM>)
fn add_assign(&mut self, other: Duration<u32, NOM, DENOM>)
Performs the +=
operation. Read more
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u32, NOM, DENOM>> for Instant<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u32, NOM, DENOM>> for Instant<u64, NOM, DENOM>
fn add_assign(&mut self, other: Duration<u32, NOM, DENOM>)
fn add_assign(&mut self, other: Duration<u32, NOM, DENOM>)
Performs the +=
operation. Read more
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u64, NOM, DENOM>> for Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u64, NOM, DENOM>> for Duration<u64, NOM, DENOM>
fn add_assign(&mut self, other: Duration<u64, NOM, DENOM>)
fn add_assign(&mut self, other: Duration<u64, NOM, DENOM>)
Performs the +=
operation. Read more
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u64, NOM, DENOM>> for Instant<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> AddAssign<Duration<u64, NOM, DENOM>> for Instant<u64, NOM, DENOM>
fn add_assign(&mut self, other: Duration<u64, NOM, DENOM>)
fn add_assign(&mut self, other: Duration<u64, NOM, DENOM>)
Performs the +=
operation. Read more
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> Div<Duration<u32, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> Div<Duration<u32, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> Div<Duration<u64, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> Div<Duration<u64, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
impl<const NOM: u32, const DENOM: u32> DivAssign<u32> for Duration<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> DivAssign<u32> for Duration<u32, NOM, DENOM>
fn div_assign(&mut self, other: u32)
fn div_assign(&mut self, other: u32)
Performs the /=
operation. Read more
impl<const NOM: u32, const DENOM: u32> DivAssign<u32> for Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> DivAssign<u32> for Duration<u64, NOM, DENOM>
fn div_assign(&mut self, other: u32)
fn div_assign(&mut self, other: u32)
Performs the /=
operation. Read more
impl<const NOM: u32, const DENOM: u32> From<Duration<u32, NOM, DENOM>> for Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> From<Duration<u32, NOM, DENOM>> for Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> MulAssign<u32> for Duration<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> MulAssign<u32> for Duration<u32, NOM, DENOM>
fn mul_assign(&mut self, other: u32)
fn mul_assign(&mut self, other: u32)
Performs the *=
operation. Read more
impl<const NOM: u32, const DENOM: u32> MulAssign<u32> for Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> MulAssign<u32> for Duration<u64, NOM, DENOM>
fn mul_assign(&mut self, other: u32)
fn mul_assign(&mut self, other: u32)
Performs the *=
operation. Read more
impl<const NOM: u32, const DENOM: u32> Ord for Duration<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> Ord for Duration<u32, NOM, DENOM>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
impl<const NOM: u32, const DENOM: u32> Ord for Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> Ord for Duration<u64, NOM, DENOM>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialEq<Duration<u32, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialEq<Duration<u32, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialEq<Duration<u32, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialEq<Duration<u32, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialEq<Duration<u64, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialEq<Duration<u64, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialEq<Duration<u64, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialEq<Duration<u64, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialOrd<Duration<u32, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialOrd<Duration<u32, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
fn partial_cmp(&self, other: &Duration<u32, R_NOM, R_DENOM>) -> Option<Ordering>
fn partial_cmp(&self, other: &Duration<u32, R_NOM, R_DENOM>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialOrd<Duration<u32, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialOrd<Duration<u32, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
fn partial_cmp(&self, other: &Duration<u32, R_NOM, R_DENOM>) -> Option<Ordering>
fn partial_cmp(&self, other: &Duration<u32, R_NOM, R_DENOM>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialOrd<Duration<u64, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialOrd<Duration<u64, R_NOM, R_DENOM>> for Duration<u32, L_NOM, L_DENOM>
fn partial_cmp(&self, other: &Duration<u64, R_NOM, R_DENOM>) -> Option<Ordering>
fn partial_cmp(&self, other: &Duration<u64, R_NOM, R_DENOM>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialOrd<Duration<u64, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
impl<const L_NOM: u32, const L_DENOM: u32, const R_NOM: u32, const R_DENOM: u32> PartialOrd<Duration<u64, R_NOM, R_DENOM>> for Duration<u64, L_NOM, L_DENOM>
fn partial_cmp(&self, other: &Duration<u64, R_NOM, R_DENOM>) -> Option<Ordering>
fn partial_cmp(&self, other: &Duration<u64, R_NOM, R_DENOM>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u32, NOM, DENOM>> for Duration<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u32, NOM, DENOM>> for Duration<u32, NOM, DENOM>
fn sub_assign(&mut self, other: Duration<u32, NOM, DENOM>)
fn sub_assign(&mut self, other: Duration<u32, NOM, DENOM>)
Performs the -=
operation. Read more
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u32, NOM, DENOM>> for Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u32, NOM, DENOM>> for Duration<u64, NOM, DENOM>
fn sub_assign(&mut self, other: Duration<u32, NOM, DENOM>)
fn sub_assign(&mut self, other: Duration<u32, NOM, DENOM>)
Performs the -=
operation. Read more
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u32, NOM, DENOM>> for Instant<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u32, NOM, DENOM>> for Instant<u32, NOM, DENOM>
fn sub_assign(&mut self, other: Duration<u32, NOM, DENOM>)
fn sub_assign(&mut self, other: Duration<u32, NOM, DENOM>)
Performs the -=
operation. Read more
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u32, NOM, DENOM>> for Instant<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u32, NOM, DENOM>> for Instant<u64, NOM, DENOM>
fn sub_assign(&mut self, other: Duration<u32, NOM, DENOM>)
fn sub_assign(&mut self, other: Duration<u32, NOM, DENOM>)
Performs the -=
operation. Read more
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u64, NOM, DENOM>> for Duration<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u64, NOM, DENOM>> for Duration<u64, NOM, DENOM>
fn sub_assign(&mut self, other: Duration<u64, NOM, DENOM>)
fn sub_assign(&mut self, other: Duration<u64, NOM, DENOM>)
Performs the -=
operation. Read more
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u64, NOM, DENOM>> for Instant<u64, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> SubAssign<Duration<u64, NOM, DENOM>> for Instant<u64, NOM, DENOM>
fn sub_assign(&mut self, other: Duration<u64, NOM, DENOM>)
fn sub_assign(&mut self, other: Duration<u64, NOM, DENOM>)
Performs the -=
operation. Read more
impl<const NOM: u32, const DENOM: u32> TryFrom<Duration<u64, NOM, DENOM>> for Duration<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> TryFrom<Duration<u64, NOM, DENOM>> for Duration<u32, NOM, DENOM>
impl<T, const NOM: u32, const DENOM: u32> Copy for Duration<T, NOM, DENOM> where
T: Copy,
impl<const NOM: u32, const DENOM: u32> Eq for Duration<u32, NOM, DENOM>
impl<const NOM: u32, const DENOM: u32> Eq for Duration<u64, NOM, DENOM>
Auto Trait Implementations
impl<T, const NOM: u32, const DENOM: u32> RefUnwindSafe for Duration<T, NOM, DENOM> where
T: RefUnwindSafe,
impl<T, const NOM: u32, const DENOM: u32> Send for Duration<T, NOM, DENOM> where
T: Send,
impl<T, const NOM: u32, const DENOM: u32> Sync for Duration<T, NOM, DENOM> where
T: Sync,
impl<T, const NOM: u32, const DENOM: u32> Unpin for Duration<T, NOM, DENOM> where
T: Unpin,
impl<T, const NOM: u32, const DENOM: u32> UnwindSafe for Duration<T, NOM, DENOM> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.