CommandHandler

Trait CommandHandler 

Source
pub trait CommandHandler {
    // Required methods
    fn get_commands(&self) -> Vec<Command>;
    fn handle_command<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        command: &'life1 VanguardCommand,
        ctx: &'life2 CommandContext,
    ) -> Pin<Box<dyn Future<Output = CommandResult> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn can_handle(&self, command_name: &str) -> bool { ... }
}
Expand description

Trait for handling commands

Required Methods§

Source

fn get_commands(&self) -> Vec<Command>

Get a list of commands supported by this handler

Source

fn handle_command<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, command: &'life1 VanguardCommand, ctx: &'life2 CommandContext, ) -> Pin<Box<dyn Future<Output = CommandResult> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle a command

Provided Methods§

Source

fn can_handle(&self, command_name: &str) -> bool

Check if this handler can handle a command

Implementors§