pub trait State<OrderKey: Ord>: Clone {
type Event: Clone + Event<OrderKey>;
// Required method
fn apply(&mut self, event: &Self::Event);
}
Expand description
A trait representing a state that can be modified by events.
The state must be clonable and can be updated based on the events it receives. Events
must have an associated order key of type OrderKey
to determine their sequence.
§Type Parameters
OrderKey
: The type that determines the order of events, which must implementOrd
.
Required Associated Types§
Required Methods§
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.