appletheia_application/command/
command_selector.rs1use crate::command::CommandName;
2use crate::messaging::Selector as MessageSelector;
3use crate::outbox::command::CommandEnvelope;
4
5#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
6pub struct CommandSelector {
7 pub command_name: CommandName,
8}
9
10impl CommandSelector {
11 pub const fn new(command_name: CommandName) -> Self {
12 Self { command_name }
13 }
14
15 pub fn matches(&self, command: &CommandEnvelope) -> bool {
16 command.command_name.value() == self.command_name.value()
17 }
18}
19
20impl MessageSelector<CommandEnvelope> for CommandSelector {
21 fn matches(&self, message: &CommandEnvelope) -> bool {
22 message.command_name.value() == self.command_name.value()
23 }
24}