Inspired by enum_dispatch
enum_handler! {
// #[boxed]
// #[reference]
enum CounterMessage {
Variant1,
Variant2,
Variant3,
// VariantN,
},
// (Type of executor, [Type of context])
(Executor)
}
The variant struct will be wrapped in a Box
.
The handle
method will be called with message.as_ref()