pub struct Seconds(pub u32);Expand description
Timestamp in seconds since Unix epoch.
Used for histogram buckets, time ranges, and coarse-grained time operations.
Tuple Fields§
§0: u32Implementations§
Source§impl Seconds
impl Seconds
Sourcepub fn to_microseconds(self) -> Microseconds
pub fn to_microseconds(self) -> Microseconds
Convert to microseconds.
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§
impl Copy for Seconds
Source§impl<'de> Deserialize<'de> for Seconds
impl<'de> Deserialize<'de> for Seconds
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
impl Eq for Seconds
Source§impl From<Seconds> for Microseconds
impl From<Seconds> for Microseconds
Source§impl Ord for Seconds
impl Ord for Seconds
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 PartialOrd for Seconds
impl PartialOrd for Seconds
impl StructuralPartialEq for Seconds
Auto Trait Implementations§
impl Freeze for Seconds
impl RefUnwindSafe for Seconds
impl Send for Seconds
impl Sync for Seconds
impl Unpin for Seconds
impl UnsafeUnpin for Seconds
impl UnwindSafe for Seconds
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