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 new(microseconds: u64) -> Microseconds
pub fn new(microseconds: u64) -> Microseconds
Create a timestamp from microseconds.
Sourcepub fn now() -> Microseconds
pub fn now() -> Microseconds
Get the current time as microseconds since Unix epoch.
Sourcepub fn to_seconds(self) -> Seconds
pub fn to_seconds(self) -> Seconds
Convert to seconds (truncates).
Sourcepub fn saturating_add(self, other: Microseconds) -> Microseconds
pub fn saturating_add(self, other: Microseconds) -> Microseconds
Add two durations with saturation at the numeric bounds.
Sourcepub fn saturating_sub(self, other: Microseconds) -> Microseconds
pub fn saturating_sub(self, other: Microseconds) -> Microseconds
Subtract two durations with saturation at the numeric bounds.
Sourcepub fn checked_add(self, other: Microseconds) -> Option<Microseconds>
pub fn checked_add(self, other: Microseconds) -> Option<Microseconds>
Checked addition. Returns None if overflow occurred.
Sourcepub fn checked_sub(self, other: Microseconds) -> Option<Microseconds>
pub fn checked_sub(self, other: Microseconds) -> Option<Microseconds>
Checked subtraction. Returns None if overflow occurred.
Sourcepub fn is_multiple_of(self, other: Microseconds) -> bool
pub fn is_multiple_of(self, other: Microseconds) -> 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§type Output = Microseconds
type Output = Microseconds
The resulting type after applying the
+ operator.Source§fn add(self, other: Microseconds) -> Microseconds
fn add(self, other: Microseconds) -> Microseconds
Performs the
+ operation. Read moreSource§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<Microseconds, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Microseconds, <__D as Deserializer<'de>>::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§fn from(s: Seconds) -> Microseconds
fn from(s: Seconds) -> Microseconds
Converts to this type from the input type.
Source§impl From<u64> for Microseconds
impl From<u64> for Microseconds
Source§fn from(us: u64) -> Microseconds
fn from(us: u64) -> Microseconds
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 (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§impl PartialOrd for Microseconds
impl PartialOrd for Microseconds
Source§impl Rem for Microseconds
impl Rem for Microseconds
Source§type Output = Microseconds
type Output = Microseconds
The resulting type after applying the
% operator.Source§fn rem(self, other: Microseconds) -> Microseconds
fn rem(self, other: Microseconds) -> Microseconds
Performs the
% operation. Read moreSource§impl Serialize for Microseconds
impl Serialize for Microseconds
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Microseconds
Source§impl Sub for Microseconds
impl Sub for Microseconds
Source§type Output = Microseconds
type Output = Microseconds
The resulting type after applying the
- operator.Source§fn sub(self, other: Microseconds) -> Microseconds
fn sub(self, other: Microseconds) -> Microseconds
Performs the
- operation. Read moreAuto 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