Struct event_store_core::event::UnsavedEvent
source · pub struct UnsavedEvent {
pub causation_id: Option<Uuid>,
pub correlation_id: Option<Uuid>,
pub event_type: String,
pub data: Value,
pub metadata: Value,
pub event_uuid: Uuid,
pub stream_uuid: String,
pub stream_version: u64,
pub created_at: DateTime<Utc>,
}
Expand description
An UnsavedEvent
is created from a type that implement Event
This kind of event represents an unsaved event, meaning that it has less informations
than a RecordedEvent
. It’s a generic form to simplify the event processing but also a way to
define metadata
, causation_id
and correlation_id
.
Fields§
§causation_id: Option<Uuid>
a causation_id
defines who caused this event
correlation_id: Option<Uuid>
a correlation_id
correlates multiple events
event_type: String
Human readable event type
data: Value
Payload of this event
metadata: Value
Metadata defined for this event
event_uuid: Uuid
§stream_uuid: String
§stream_version: u64
§created_at: DateTime<Utc>
Implementations§
source§impl UnsavedEvent
impl UnsavedEvent
sourcepub fn try_from<E: Event>(event: &E) -> Result<Self, UnsavedEventError>
pub fn try_from<E: Event>(event: &E) -> Result<Self, UnsavedEventError>
Try to create an UnsavedEvent
from a struct that implement Event
.
In case of a success an UnsavedEvent
is returned with no context or metadata.
Errors
If serde
isn’t able to serialize the Event
an UnsavedEventError::SerializeError
is
returned
Trait Implementations§
source§impl Clone for UnsavedEvent
impl Clone for UnsavedEvent
source§fn clone(&self) -> UnsavedEvent
fn clone(&self) -> UnsavedEvent
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for UnsavedEvent
impl Debug for UnsavedEvent
source§impl PartialEq<UnsavedEvent> for UnsavedEvent
impl PartialEq<UnsavedEvent> for UnsavedEvent
source§fn eq(&self, other: &UnsavedEvent) -> bool
fn eq(&self, other: &UnsavedEvent) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for UnsavedEvent
Auto Trait Implementations§
impl RefUnwindSafe for UnsavedEvent
impl Send for UnsavedEvent
impl Sync for UnsavedEvent
impl Unpin for UnsavedEvent
impl UnwindSafe for UnsavedEvent
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