Command can already be use with enum and newtype but the Command derive only support struct.
#[derive(Debug)]
struct AppendItem(i64);
impl Command for AppendItem {
type Event = ItemAppended;
type Executor = ExampleAggregate;
type ExecutorRegistry = AggregateInstanceRegistry<ExampleAggregate>;
fn identifier(&self) -> String {
"example_aggregate".to_string()
}
}
It could be possible to have an enum which can be dispatch to the CommandExecutor.
Some questions need to be resolved first:
- How to deal with command's
identity ?
- Is it really necessary ?
Commandcan already be use withenumandnewtypebut theCommandderive only supportstruct.It could be possible to have an
enumwhich can be dispatch to theCommandExecutor.Some questions need to be resolved first:
identity?