pub struct RecordedAt(/* private fields */);Expand description
When the store accepted an event: milliseconds since the Unix epoch, UTC.
§This is not an ordering key
Nothing may derive an order from it, and the contract states no relationship
between RecordedAt order and SequencePosition
order. Two events in one batch may share a millisecond; a store whose clock
steps backwards may stamp a later event with an earlier time. Positions order
events. This records a fact about the world for an auditor, and answers “when
did this land”, which no position can.
Preserved unchanged through ingest, so a replicated event keeps the time its origin recorded rather than acquiring its arrival time here.
§Why i64 and not SystemTime
SystemTime is not no_std, and this crate is no_std-capable. A chrono
or jiff dependency would be the largest in the contract crate and would buy
nothing the store needs — the store is the only thing that ever sets this,
and an adapter that has a clock can produce an integer from it. Signed rather
than unsigned because times before 1970 are representable rather than
wrapping, which costs nothing and removes a class of surprise.
§It deliberately does not implement PartialOrd or Ord
The paragraph above is a rule, and until 0.2.0 this type carried a derive
that handed a caller the exact operation the rule forbids — sixteen lines
apart, with the affordance winning, because a derive is reachable and a
sentence is not. Nothing in this workspace ever ordered one.
A reader who wants events in the order they happened wants
SequencePosition, and now gets told so by the compiler rather than by a
doc comment. Removing a derive is a breaking change, so this was the last
release at which it was free: nothing was published at a compatible version,
and no consumer was pinned.
Implementations§
Source§impl RecordedAt
impl RecordedAt
Trait Implementations§
Source§impl Clone for RecordedAt
impl Clone for RecordedAt
impl Copy for RecordedAt
Source§impl Debug for RecordedAt
impl Debug for RecordedAt
Source§impl<'de> Deserialize<'de> for RecordedAt
Available on crate feature serde only.
impl<'de> Deserialize<'de> for RecordedAt
serde only.Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Source§impl Display for RecordedAt
impl Display for RecordedAt
impl Eq for RecordedAt
Source§impl Hash for RecordedAt
impl Hash for RecordedAt
Source§impl PartialEq for RecordedAt
impl PartialEq for RecordedAt
Source§impl Serialize for RecordedAt
Available on crate feature serde only.
impl Serialize for RecordedAt
serde only.