pub trait MultiState<ID: EventId, E: Event + Clone> {
// Required methods
fn mutate_all<I: Into<StreamItem<ID, E>>>(&mut self, item: I);
fn query_all(&self) -> StreamQuery<ID, E>;
fn version(&self) -> ID;
}Expand description
A group of states that can be queried and modified together.
The states can be mutated collectively based on an event retrieved from the event store, and a unified query can be generated for all sub-states.
§Type Parameters
E: The type of events that the multi-state object handles.
Required Methods§
Sourcefn mutate_all<I: Into<StreamItem<ID, E>>>(&mut self, item: I)
fn mutate_all<I: Into<StreamItem<ID, E>>>(&mut self, item: I)
Mutates all sub-states based on the provided event.
§Arguments
event- The event to be applied to mutate the sub-states.
Sourcefn query_all(&self) -> StreamQuery<ID, E>
fn query_all(&self) -> StreamQuery<ID, E>
The unified query that represents the union of queries for all sub-states.
This query can be used to retrieve a stream of events relevant to the entire multi-state object.
§Returns
A StreamQuery representing the combined query for all sub-states.
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.