Skip to main content

EventRecord

Struct EventRecord 

Source
pub struct EventRecord {
    pub id: EventId,
    pub image: Option<ImageRef>,
    pub kind: EventKind,
    pub payload: Value,
    pub print_id: Option<PrintId>,
    pub raw: Option<RawBytes>,
    pub received_at: Timestamp,
    pub source: EventSource,
}
Expand description

One event, as the store holds it and the server serves it.

raw holds the bytes exactly as received for an externally sourced event and is absent for an internally raised one — it is what makes the history auditable when a normalization turns out to be wrong. print_id is optional, because an externally sourced event may name no print this system knows.

Fields§

§id: EventId

This event’s identifier, minted by the store.

§image: Option<ImageRef>

The image it arrived with, when it arrived with one.

§kind: EventKind

Which event this is.

§payload: Value

What it carries, in the form its kind declares.

§print_id: Option<PrintId>

The print it belongs to, when it belongs to one.

§raw: Option<RawBytes>

The bytes exactly as received, for an externally sourced event.

§received_at: Timestamp

When it was received.

§source: EventSource

Where it came from.

Implementations§

Source§

impl EventRecord

Source

pub fn payload_as<P: EventPayloadKind>(&self) -> Option<Result<P, Error>>

The payload as P, when this event is under the kind P declares.

Answers None for an event of any other kind — one this client knows or one it does not — and the parse failure for an event under the right kind whose payload is not of the type.

Trait Implementations§

Source§

impl Clone for EventRecord

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 Debug for EventRecord

Source§

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

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

impl<'de> Deserialize<'de> for EventRecord

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl PartialEq for EventRecord

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 EventRecord

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

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

impl StructuralPartialEq for EventRecord

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, 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.