CommandHandler

Trait CommandHandler 

Source
pub trait CommandHandler: Send + Sync {
    // Required method
    fn handle_command<'life0, 'async_trait>(
        &'life0 self,
        dispatched: DispatchedCommand,
    ) -> Pin<Box<dyn Future<Output = DispatchedCommand> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn command_handler_name(&self) -> &'static str { ... }
}
Expand description

A command’s handler must implement this trait

Required Methods§

Source

fn handle_command<'life0, 'async_trait>( &'life0 self, dispatched: DispatchedCommand, ) -> Pin<Box<dyn Future<Output = DispatchedCommand> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

This method is call to handle the dispatched command

Provided Methods§

Source

fn command_handler_name(&self) -> &'static str

A unique name for this handler By default, the path to the type is used

Implementors§