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> Clone for CommittedEvent<E>
impl<E: Clone> Clone for CommittedEvent<E>
Source§impl<E: Debug> Debug for CommittedEvent<E>
impl<E: Debug> Debug for CommittedEvent<E>
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<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
impl<E: Eq> Eq for CommittedEvent<E>
Source§impl<E> From<CommittedEvent<E>> for ReceiptEvent<E>
impl<E> From<CommittedEvent<E>> for ReceiptEvent<E>
Source§fn from(event: CommittedEvent<E>) -> Self
fn from(event: CommittedEvent<E>) -> Self
Converts to this type from the input type.
Source§impl<E: PartialEq> PartialEq for CommittedEvent<E>
impl<E: PartialEq> PartialEq for CommittedEvent<E>
Source§impl<E> Serialize for CommittedEvent<E>where
E: Serialize,
impl<E> Serialize for CommittedEvent<E>where
E: Serialize,
impl<E: PartialEq> StructuralPartialEq for CommittedEvent<E>
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.