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 typePos: The position type used for orderingData: The serialised event payload type (e.g.,serde_json::Value)M: The metadata type
Fields§
§aggregate_kind: StringThe aggregate type identifier (e.g., "account").
aggregate_id: IdThe aggregate instance identifier.
kind: StringThe event type identifier (e.g., "account.deposited").
position: PosThe global position assigned by the store.
data: DataThe serialised event payload.
metadata: MInfrastructure metadata (timestamps, causation IDs, etc.).
Implementations§
Source§impl<Id, Pos, Data, M> StoredEvent<Id, Pos, Data, M>
impl<Id, Pos, Data, M> StoredEvent<Id, Pos, Data, M>
Sourcepub fn aggregate_kind(&self) -> &str
pub fn aggregate_kind(&self) -> &str
Returns the aggregate type identifier.
Sourcepub const fn aggregate_id(&self) -> &Id
pub const fn aggregate_id(&self) -> &Id
Returns a reference to the aggregate instance identifier.
Trait Implementations§
Auto Trait Implementations§
impl<Id, Pos, Data, M> Freeze for StoredEvent<Id, Pos, Data, M>
impl<Id, Pos, Data, M> RefUnwindSafe for StoredEvent<Id, Pos, Data, M>
impl<Id, Pos, Data, M> Send for StoredEvent<Id, Pos, Data, M>
impl<Id, Pos, Data, M> Sync for StoredEvent<Id, Pos, Data, M>
impl<Id, Pos, Data, M> Unpin for StoredEvent<Id, Pos, Data, M>
impl<Id, Pos, Data, M> UnwindSafe for StoredEvent<Id, Pos, Data, M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more