#[repr(C)]pub struct UnixNanos(/* private fields */);
Expand description
Represents a timestamp in nanoseconds since the UNIX epoch.
Implementations§
Source§impl UnixNanos
impl UnixNanos
Sourcepub const fn to_datetime_utc(&self) -> DateTime<Utc>
pub const fn to_datetime_utc(&self) -> DateTime<Utc>
Converts the underlying value to a datetime (UTC).
Sourcepub const fn duration_since(&self, other: &Self) -> Option<DurationNanos>
pub const fn duration_since(&self, other: &Self) -> Option<DurationNanos>
Calculates the duration in nanoseconds since another UnixNanos
instance.
Returns Some(duration)
if self
is later than other
, otherwise None
if other
is
greater than self
(indicating a negative duration is not possible with DurationNanos
).
Trait Implementations§
Source§impl<T: Into<u64>> AddAssign<T> for UnixNanos
impl<T: Into<u64>> AddAssign<T> for UnixNanos
Source§fn add_assign(&mut self, other: T)
fn add_assign(&mut self, other: T)
Performs the
+=
operation. Read moreSource§impl<'de> Deserialize<'de> for UnixNanos
impl<'de> Deserialize<'de> for UnixNanos
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>,
Deserializes a UnixNanos
from various formats:
- Integer values are interpreted as nanoseconds since the UNIX epoch
- Floating-point values are interpreted as seconds since the UNIX epoch (converted to nanoseconds)
- String values may be:
- A numeric string (interpreted as nanoseconds).
- A floating-point string (interpreted as seconds, converted to nanoseconds).
- An RFC 3339 formatted timestamp (ISO 8601 with timezone).
Negative timestamps are rejected with an error.
Source§impl Ord for UnixNanos
impl Ord for UnixNanos
Source§impl PartialOrd<Option<u64>> for UnixNanos
impl PartialOrd<Option<u64>> for UnixNanos
Source§impl PartialOrd<u64> for UnixNanos
impl PartialOrd<u64> for UnixNanos
Source§impl PartialOrd for UnixNanos
impl PartialOrd for UnixNanos
Source§impl<T: Into<u64>> SubAssign<T> for UnixNanos
impl<T: Into<u64>> SubAssign<T> for UnixNanos
Source§fn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
Performs the
-=
operation. Read moreimpl Copy for UnixNanos
impl Eq for UnixNanos
impl StructuralPartialEq for UnixNanos
Auto Trait Implementations§
impl Freeze for UnixNanos
impl RefUnwindSafe for UnixNanos
impl Send for UnixNanos
impl Sync for UnixNanos
impl Unpin for UnixNanos
impl UnwindSafe for UnixNanos
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.