pub enum ReceiptEvent<E> {
Committed(CommittedEvent<E>),
Redacted(RedactedEvent),
}Expand description
One event as offered to
WorkflowDefinition::receipts:
its payload is either still in the ledger or has been erased.
A domain matches on this rather than on a payload that failed to deserialize, which is the difference between a receipt that says something honest about an erased event and a turn that renders as though the data were still there.
§It is deliberately not #[non_exhaustive]
A payload is present or it is not; there is no third case, and the exhaustive match is the mechanism. A wildcard arm here is exactly the arm that would render an erased event as though nothing had happened, so a future variant — if one is ever justified — must break the domains that render receipts rather than fall silently into their catch-all.
Variants§
Committed(CommittedEvent<E>)
The payload is in the ledger; the receipt may say what changed.
Redacted(RedactedEvent)
The payload was erased; the receipt may say that it happened, and that the detail is gone.
Implementations§
Source§impl<E> ReceiptEvent<E>
impl<E> ReceiptEvent<E>
Sourcepub fn event_id(&self) -> EventId
pub fn event_id(&self) -> EventId
Identifier in the ledger, whether or not the payload survived.
Sourcepub fn event_type(&self) -> &str
pub fn event_type(&self) -> &str
Stable event type label, whether or not the payload survived.
Sourcepub fn occurred_at(&self) -> DateTime<Utc>
pub fn occurred_at(&self) -> DateTime<Utc>
When the event was committed, whether or not the payload survived.
Sourcepub fn redaction(&self) -> Option<&EventRedaction>
pub fn redaction(&self) -> Option<&EventRedaction>
The erasure record, or None while the payload is still there.
Sourcepub fn is_redacted(&self) -> bool
pub fn is_redacted(&self) -> bool
Returns true when the payload was erased.
Sourcepub fn try_map_payload_ref<F, Err>(
&self,
f: impl FnOnce(&E) -> Result<F, Err>,
) -> Result<ReceiptEvent<F>, Err>
pub fn try_map_payload_ref<F, Err>( &self, f: impl FnOnce(&E) -> Result<F, Err>, ) -> Result<ReceiptEvent<F>, Err>
Transforms the payload by reference, keeping identity and timestamp.
A redacted event passes through untouched: there is nothing to convert, which is why the type-erasure boundary can hand a domain an erased event without ever trying — and failing — to deserialize an empty payload.
§Errors
Whatever f returns for a payload that is still present.
Trait Implementations§
Source§impl<E: Clone> Clone for ReceiptEvent<E>
impl<E: Clone> Clone for ReceiptEvent<E>
Source§impl<E: Debug> Debug for ReceiptEvent<E>
impl<E: Debug> Debug for ReceiptEvent<E>
impl<E: Eq> Eq for ReceiptEvent<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
Source§impl<E> From<RedactedEvent> for ReceiptEvent<E>
impl<E> From<RedactedEvent> for ReceiptEvent<E>
Source§fn from(event: RedactedEvent) -> Self
fn from(event: RedactedEvent) -> Self
Source§impl<E: PartialEq> PartialEq for ReceiptEvent<E>
impl<E: PartialEq> PartialEq for ReceiptEvent<E>
impl<E: PartialEq> StructuralPartialEq for ReceiptEvent<E>
Auto Trait Implementations§
impl<E> Freeze for ReceiptEvent<E>where
CommittedEvent<E>: Freeze,
impl<E> RefUnwindSafe for ReceiptEvent<E>where
CommittedEvent<E>: RefUnwindSafe,
impl<E> Send for ReceiptEvent<E>where
CommittedEvent<E>: Send,
impl<E> Sync for ReceiptEvent<E>where
CommittedEvent<E>: Sync,
impl<E> Unpin for ReceiptEvent<E>where
CommittedEvent<E>: Unpin,
impl<E> UnsafeUnpin for ReceiptEvent<E>where
CommittedEvent<E>: UnsafeUnpin,
impl<E> UnwindSafe for ReceiptEvent<E>where
CommittedEvent<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
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,
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
key and return true if they are equal.