pub struct StoredEvent<E: Event> { /* private fields */ }Expand description
Represents a stored event, including metadata.
Implementations§
Source§impl<E: Event> StoredEvent<E>
impl<E: Event> StoredEvent<E>
Sourcepub fn new(
aggregate_id: String,
version: i64,
event_version: u16,
event_type: String,
event: E,
) -> Self
pub fn new( aggregate_id: String, version: i64, event_version: u16, event_type: String, event: E, ) -> Self
Creates a new stored event.
Sourcepub fn aggregate_id(&self) -> &str
pub fn aggregate_id(&self) -> &str
Returns the ID of the aggregate this event belongs to.
Sourcepub fn version(&self) -> i64
pub fn version(&self) -> i64
Returns the version of the aggregate after this event was applied.
Sourcepub fn event_version(&self) -> u16
pub fn event_version(&self) -> u16
Returns the version of the event’s schema.
Sourcepub fn event_type(&self) -> &str
pub fn event_type(&self) -> &str
Returns the type of the event.
Sourcepub fn into_event(self) -> E
pub fn into_event(self) -> E
Consumes the stored event and returns the event payload.
Trait Implementations§
Source§impl<E: Clone + Event> Clone for StoredEvent<E>
impl<E: Clone + Event> Clone for StoredEvent<E>
Source§fn clone(&self) -> StoredEvent<E>
fn clone(&self) -> StoredEvent<E>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'de, E> Deserialize<'de> for StoredEvent<E>where
E: DeserializeOwned + Event,
impl<'de, E> Deserialize<'de> for StoredEvent<E>where
E: DeserializeOwned + Event,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<E> Freeze for StoredEvent<E>where
E: Freeze,
impl<E> RefUnwindSafe for StoredEvent<E>where
E: RefUnwindSafe,
impl<E> Send for StoredEvent<E>
impl<E> Sync for StoredEvent<E>
impl<E> Unpin for StoredEvent<E>where
E: Unpin,
impl<E> UnwindSafe for StoredEvent<E>where
E: UnwindSafe,
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