busstop/command/command_handler.rs
1use super::dispatched_command::DispatchedCommand;
2
3/// A command's handler must implement this trait
4#[async_trait::async_trait]
5pub trait CommandHandler: Send + Sync {
6 /// This method is call to handle the dispatched command
7 async fn handle_command(&self, dispatched: DispatchedCommand) -> DispatchedCommand;
8
9 /// A unique name for this handler
10 /// By default, the path to the type is used
11 fn command_handler_name(&self) -> &'static str {
12 std::any::type_name::<Self>()
13 }
14}