externally_driven_async_rt/state.rs
1/// A trait that your custom state must implement.
2pub trait State: 'static {
3 /// An event type.
4 type Event;
5
6 /// Your logic of event handling.
7 ///
8 /// Internally called when you call [`Context::dispatch`](crate::Context::dispatch).
9 fn apply(&mut self, event: Self::Event);
10}
11
12impl State for () {
13 type Event = ();
14
15 fn apply(&mut self, _: Self::Event) {}
16}