pub struct Microseconds(pub u64);Expand description
Timestamp in microseconds since Unix epoch.
Used for journal entry timestamps and fine-grained time operations.
Tuple Fields§
§0: u64Implementations§
Source§impl Microseconds
impl Microseconds
Sourcepub fn to_seconds(self) -> Seconds
pub fn to_seconds(self) -> Seconds
Convert to seconds (truncates).
Sourcepub fn saturating_add(self, other: Self) -> Self
pub fn saturating_add(self, other: Self) -> Self
Add two durations with saturation at the numeric bounds.
Sourcepub fn saturating_sub(self, other: Self) -> Self
pub fn saturating_sub(self, other: Self) -> Self
Subtract two durations with saturation at the numeric bounds.
Sourcepub fn checked_add(self, other: Self) -> Option<Self>
pub fn checked_add(self, other: Self) -> Option<Self>
Checked addition. Returns None if overflow occurred.
Sourcepub fn checked_sub(self, other: Self) -> Option<Self>
pub fn checked_sub(self, other: Self) -> Option<Self>
Checked subtraction. Returns None if overflow occurred.
Sourcepub fn is_multiple_of(self, other: Self) -> bool
pub fn is_multiple_of(self, other: Self) -> bool
Returns true if this duration is a multiple of the other duration.
Useful for checking if bucket durations align.
Trait Implementations§
Source§impl Add for Microseconds
impl Add for Microseconds
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for Microseconds
Source§impl Debug for Microseconds
impl Debug for Microseconds
Source§impl<'de> Deserialize<'de> for Microseconds
impl<'de> Deserialize<'de> for Microseconds
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Microseconds
impl Display for Microseconds
impl Eq for Microseconds
Source§impl From<Seconds> for Microseconds
impl From<Seconds> for Microseconds
Source§impl From<u64> for Microseconds
impl From<u64> for Microseconds
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 (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
Source§impl PartialEq for Microseconds
impl PartialEq for Microseconds
Source§fn eq(&self, other: &Microseconds) -> bool
fn eq(&self, other: &Microseconds) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl PartialOrd for Microseconds
impl PartialOrd for Microseconds
Source§impl Rem for Microseconds
impl Rem for Microseconds
Source§impl Serialize for Microseconds
impl Serialize 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 UnsafeUnpin 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