pub trait State: 'static {
type Event;
// Required method
fn apply(&mut self, event: Self::Event);
}Expand description
A trait that your custom state must implement.
Required Associated Types§
Required Methods§
Sourcefn apply(&mut self, event: Self::Event)
fn apply(&mut self, event: Self::Event)
Your logic of event handling.
Internally called when you call Context::dispatch.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".