pub struct CommittedEvent<E> {
pub event_id: EventId,
pub event_type: String,
pub occurred_at: DateTime<Utc>,
pub payload: E,
}Expand description
One committed domain event (spec §17.1).
Fields§
§event_id: EventIdIdentifier in the ledger.
event_type: StringStable event type label (e.g. "trip.extra_added").
occurred_at: DateTime<Utc>When it was committed.
payload: EDomain payload.
Implementations§
Source§impl<E> CommittedEvent<E>
impl<E> CommittedEvent<E>
Sourcepub fn try_map_payload<F, Err>(
self,
f: impl FnOnce(E) -> Result<F, Err>,
) -> Result<CommittedEvent<F>, Err>
pub fn try_map_payload<F, Err>( self, f: impl FnOnce(E) -> Result<F, Err>, ) -> Result<CommittedEvent<F>, Err>
Transforms the payload.
Sourcepub fn try_map_payload_ref<F, Err>(
&self,
f: impl FnOnce(&E) -> Result<F, Err>,
) -> Result<CommittedEvent<F>, Err>
pub fn try_map_payload_ref<F, Err>( &self, f: impl FnOnce(&E) -> Result<F, Err>, ) -> Result<CommittedEvent<F>, Err>
Transforms the payload by reference, keeping identity and timestamp.
Used at the erasure boundary, where the payload is deserialized from the borrowed JSON instead of being cloned into the typed side.
Trait Implementations§
Source§impl<E> Clone for CommittedEvent<E>where
E: Clone,
impl<E> Clone for CommittedEvent<E>where
E: Clone,
Source§fn clone(&self) -> CommittedEvent<E>
fn clone(&self) -> CommittedEvent<E>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<E> Debug for CommittedEvent<E>where
E: Debug,
impl<E> Debug for CommittedEvent<E>where
E: Debug,
Source§impl<'de, E> Deserialize<'de> for CommittedEvent<E>where
E: Deserialize<'de>,
impl<'de, E> Deserialize<'de> for CommittedEvent<E>where
E: Deserialize<'de>,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CommittedEvent<E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CommittedEvent<E>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<E> Eq for CommittedEvent<E>where
E: Eq,
Source§impl<E> From<CommittedEvent<E>> for ReceiptEvent<E>
impl<E> From<CommittedEvent<E>> for ReceiptEvent<E>
Source§fn from(event: CommittedEvent<E>) -> ReceiptEvent<E>
fn from(event: CommittedEvent<E>) -> ReceiptEvent<E>
Converts to this type from the input type.
Source§impl<E> PartialEq for CommittedEvent<E>where
E: PartialEq,
impl<E> PartialEq for CommittedEvent<E>where
E: PartialEq,
Source§impl<E> Serialize for CommittedEvent<E>where
E: Serialize,
impl<E> Serialize for CommittedEvent<E>where
E: Serialize,
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<E> StructuralPartialEq for CommittedEvent<E>where
E: PartialEq,
Auto Trait Implementations§
impl<E> Freeze for CommittedEvent<E>where
E: Freeze,
impl<E> RefUnwindSafe for CommittedEvent<E>where
E: RefUnwindSafe,
impl<E> Send for CommittedEvent<E>where
E: Send,
impl<E> Sync for CommittedEvent<E>where
E: Sync,
impl<E> Unpin for CommittedEvent<E>where
E: Unpin,
impl<E> UnsafeUnpin for CommittedEvent<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for CommittedEvent<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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.