pub struct Duration(/* private fields */);Expand description
A span of time, in microseconds.
Implementations§
Source§impl Duration
impl Duration
Sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
From microseconds.
Sourcepub const fn from_millis(millis: u64) -> Self
pub const fn from_millis(millis: u64) -> Self
From milliseconds, saturating.
Sourcepub const fn saturating_add(self, other: Self) -> Self
pub const fn saturating_add(self, other: Self) -> Self
Addition that saturates instead of wrapping.
Sourcepub const fn saturating_sub(self, other: Self) -> Self
pub const fn saturating_sub(self, other: Self) -> Self
Subtraction that saturates at zero.
Sourcepub const fn saturating_mul(self, factor: u64) -> Self
pub const fn saturating_mul(self, factor: u64) -> Self
Multiplication by a scalar, saturating.
Sourcepub const fn mul_ratio(self, numerator: u64, denominator: u64) -> Self
pub const fn mul_ratio(self, numerator: u64, denominator: u64) -> Self
Multiplication by a rational numerator / denominator, saturating.
MRP’s backoff constants are rationals — a base of 1.6, a jitter of 0.25, a margin of 1.1 (Core §4.12.2.1) — and doing that in floating point on a microcontroller that has no FPU is both slow and needlessly imprecise. This is how the crate computes them.
Trait Implementations§
impl Copy for Duration
impl Eq for Duration
Source§impl Ord for Duration
impl Ord for Duration
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Duration
impl PartialOrd for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations§
impl Forget for Duration
impl Freeze for Duration
impl Move for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnsafeUnpin for Duration
impl UnwindSafe for Duration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more