pub struct Microseconds(pub u64);Expand description
Duration in microseconds.
This wrapper provides consistent serialization of durations across different formats. Microseconds offer good precision while fitting in a u64 for durations up to ~584,000 years.
Tuple Fields§
§0: u64Implementations§
Source§impl Microseconds
impl Microseconds
Sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
Create from microseconds.
Sourcepub const fn from_millis(millis: u64) -> Self
pub const fn from_millis(millis: u64) -> Self
Create from milliseconds.
Sourcepub const fn to_duration(&self) -> Duration
pub const fn to_duration(&self) -> Duration
Convert to a standard Duration.
Trait Implementations§
Source§impl Clone for Microseconds
impl Clone for Microseconds
Source§fn clone(&self) -> Microseconds
fn clone(&self) -> Microseconds
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Microseconds
impl Debug for Microseconds
Source§impl Default for Microseconds
impl Default for Microseconds
Source§fn default() -> Microseconds
fn default() -> Microseconds
Returns the “default value” for a type. Read more
Source§impl From<Duration> for Microseconds
impl From<Duration> for Microseconds
Source§impl From<Microseconds> for Duration
impl From<Microseconds> for Duration
Source§fn from(m: Microseconds) -> Self
fn from(m: Microseconds) -> Self
Converts to this type from the input type.
Source§impl Hash for Microseconds
impl Hash for Microseconds
Source§impl Ord for Microseconds
impl Ord for Microseconds
Source§fn cmp(&self, other: &Microseconds) -> Ordering
fn cmp(&self, other: &Microseconds) -> Ordering
1.21.0 · 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
Source§impl PartialEq for Microseconds
impl PartialEq for Microseconds
Source§impl PartialOrd for Microseconds
impl PartialOrd for Microseconds
impl Copy for Microseconds
impl Eq for Microseconds
impl StructuralPartialEq for Microseconds
Auto Trait Implementations§
impl Freeze for Microseconds
impl RefUnwindSafe for Microseconds
impl Send for Microseconds
impl Sync for Microseconds
impl Unpin for Microseconds
impl UnwindSafe for Microseconds
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