Skip to main content

StoredEvent

Struct StoredEvent 

Source
pub struct StoredEvent<Id, Pos, Data, M> {
    pub aggregate_kind: String,
    pub aggregate_id: Id,
    pub kind: String,
    pub position: Pos,
    pub data: Data,
    pub metadata: M,
}
Expand description

An event loaded from the store.

Contains the serialised event data plus store-assigned metadata. Returned by EventStore::load_events. Use EventStore::decode_event to deserialise the data field back into a domain event.

§Type Parameters

  • Id: The aggregate identifier type
  • Pos: The position type used for ordering
  • Data: The serialised event payload type (e.g., serde_json::Value)
  • M: The metadata type

Fields§

§aggregate_kind: String

The aggregate type identifier (e.g., "account").

§aggregate_id: Id

The aggregate instance identifier.

§kind: String

The event type identifier (e.g., "account.deposited").

§position: Pos

The global position assigned by the store.

§data: Data

The serialised event payload.

§metadata: M

Infrastructure metadata (timestamps, causation IDs, etc.).

Implementations§

Source§

impl<Id, Pos, Data, M> StoredEvent<Id, Pos, Data, M>

Source

pub fn aggregate_kind(&self) -> &str

Returns the aggregate type identifier.

Source

pub const fn aggregate_id(&self) -> &Id

Returns a reference to the aggregate instance identifier.

Source

pub fn kind(&self) -> &str

Returns the event type identifier.

Source

pub const fn metadata(&self) -> &M

Returns a reference to the metadata.

Source§

impl<Id, Pos: Clone, Data, M> StoredEvent<Id, Pos, Data, M>

Source

pub fn position(&self) -> Pos

Returns a copy of the position.

Trait Implementations§

Source§

impl<Id: Clone, Pos: Clone, Data: Clone, M: Clone> Clone for StoredEvent<Id, Pos, Data, M>

Source§

fn clone(&self) -> StoredEvent<Id, Pos, Data, M>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<Id: Debug, Pos: Debug, Data: Debug, M: Debug> Debug for StoredEvent<Id, Pos, Data, M>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Id, Pos, Data, M> Freeze for StoredEvent<Id, Pos, Data, M>
where Id: Freeze, Pos: Freeze, Data: Freeze, M: Freeze,

§

impl<Id, Pos, Data, M> RefUnwindSafe for StoredEvent<Id, Pos, Data, M>

§

impl<Id, Pos, Data, M> Send for StoredEvent<Id, Pos, Data, M>
where Id: Send, Pos: Send, Data: Send, M: Send,

§

impl<Id, Pos, Data, M> Sync for StoredEvent<Id, Pos, Data, M>
where Id: Sync, Pos: Sync, Data: Sync, M: Sync,

§

impl<Id, Pos, Data, M> Unpin for StoredEvent<Id, Pos, Data, M>
where Id: Unpin, Pos: Unpin, Data: Unpin, M: Unpin,

§

impl<Id, Pos, Data, M> UnwindSafe for StoredEvent<Id, Pos, Data, M>
where Id: UnwindSafe, Pos: UnwindSafe, Data: UnwindSafe, M: UnwindSafe,

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more