pub trait ProjectionEvent: Sized {
const EVENT_KINDS: &'static [&'static str];
// Required method
fn from_stored<S>(
stored: &StoredEvent<<S as EventStore>::Id, <S as EventStore>::Position, <S as EventStore>::Data, <S as EventStore>::Metadata>,
store: &S,
) -> Result<Self, EventDecodeError<<S as EventStore>::Error>>
where S: EventStore;
}Expand description
Trait for event sum types that can deserialise themselves from stored events.
Implemented by event enums to deserialise stored events.
Deriving Aggregate includes a
ProjectionEvent implementation for the generated sum type. Custom enums
can opt in manually using the pattern illustrated below.
Required Associated Constants§
Sourceconst EVENT_KINDS: &'static [&'static str]
const EVENT_KINDS: &'static [&'static str]
The list of event kinds this sum type can deserialise.
This data is generated automatically when using the derive macros.
Required Methods§
Sourcefn from_stored<S>(
stored: &StoredEvent<<S as EventStore>::Id, <S as EventStore>::Position, <S as EventStore>::Data, <S as EventStore>::Metadata>,
store: &S,
) -> Result<Self, EventDecodeError<<S as EventStore>::Error>>where
S: EventStore,
fn from_stored<S>(
stored: &StoredEvent<<S as EventStore>::Id, <S as EventStore>::Position, <S as EventStore>::Data, <S as EventStore>::Metadata>,
store: &S,
) -> Result<Self, EventDecodeError<<S as EventStore>::Error>>where
S: EventStore,
Deserialise an event from stored representation.
§Errors
Returns EventDecodeError::UnknownKind if the event kind is not
recognised, or EventDecodeError::Store if deserialisation fails.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.