pub struct Timestamp(/* private fields */);Expand description
UTC timestamp used everywhere in the domain.
Wrapping OffsetDateTime keeps the public surface small (we only ever need
“now”, unix conversions, and ordering) and lets us swap the underlying crate
later without touching call sites.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn from_offset_date_time(odt: OffsetDateTime) -> Self
pub fn from_offset_date_time(odt: OffsetDateTime) -> Self
Construct from a raw OffsetDateTime. Adapters that need
“current time” (e.g. SystemClock in smos) call this
with OffsetDateTime::now_utc(); the domain crate itself never
reaches for wall-clock time so it stays IO-free.
pub fn from_unix_secs(secs: i64) -> Result<Self, DomainError>
pub fn from_unix_millis(ms: i64) -> Result<Self, DomainError>
pub fn as_unix_secs(&self) -> i64
pub fn as_unix_millis(&self) -> i64
pub fn as_offset_date_time(&self) -> OffsetDateTime
Trait Implementations§
impl Copy for Timestamp
Source§impl<'de> Deserialize<'de> for Timestamp
impl<'de> Deserialize<'de> for Timestamp
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 Timestamp
Source§impl Ord for Timestamp
impl Ord for Timestamp
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 Timestamp
impl PartialOrd for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
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