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: EventIdThis event’s identifier, minted by the store.
image: Option<ImageRef>The image it arrived with, when it arrived with one.
kind: EventKindWhich event this is.
payload: ValueWhat 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: TimestampWhen it was received.
source: EventSourceWhere it came from.
Implementations§
Source§impl EventRecord
impl EventRecord
Sourcepub fn payload_as<P: EventPayloadKind>(&self) -> Option<Result<P, Error>>
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.