Skip to main content

ReceiptEvent

Enum ReceiptEvent 

Source
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>

Source

pub fn event_id(&self) -> EventId

Identifier in the ledger, whether or not the payload survived.

Source

pub fn event_type(&self) -> &str

Stable event type label, whether or not the payload survived.

Source

pub fn occurred_at(&self) -> DateTime<Utc>

When the event was committed, whether or not the payload survived.

Source

pub fn event_ref(&self) -> EventRef

Reference without payload, which is all a receipt cites.

Source

pub fn payload(&self) -> Option<&E>

The payload, or None when it was erased.

Source

pub fn redaction(&self) -> Option<&EventRedaction>

The erasure record, or None while the payload is still there.

Source

pub fn is_redacted(&self) -> bool

Returns true when the payload was erased.

Source

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>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<E: Debug> Debug for ReceiptEvent<E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<E: Eq> Eq for ReceiptEvent<E>

Source§

impl<E> From<CommittedEvent<E>> for ReceiptEvent<E>

Source§

fn from(event: CommittedEvent<E>) -> Self

Converts to this type from the input type.
Source§

impl<E> From<RedactedEvent> for ReceiptEvent<E>

Source§

fn from(event: RedactedEvent) -> Self

Converts to this type from the input type.
Source§

impl<E: PartialEq> PartialEq for ReceiptEvent<E>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<E: PartialEq> StructuralPartialEq for ReceiptEvent<E>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.