Skip to main content

RecordedAt

Struct RecordedAt 

Source
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

Source

pub const fn from_millis(millis: i64) -> Self

Wraps a count of milliseconds since the Unix epoch.

Source

pub const fn as_millis(self) -> i64

Milliseconds since the Unix epoch.

Trait Implementations§

Source§

impl Clone for RecordedAt

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RecordedAt

Source§

impl Debug for RecordedAt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for RecordedAt

Available on crate feature serde only.
Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for RecordedAt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RecordedAt

Source§

impl Hash for RecordedAt

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RecordedAt

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for RecordedAt

Available on crate feature serde only.
Source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for RecordedAt

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.