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§
Sourcefn get_commands(&self) -> Vec<Command>
fn get_commands(&self) -> Vec<Command>
Get a list of commands supported by this handler
Sourcefn 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,
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§
Sourcefn can_handle(&self, command_name: &str) -> bool
fn can_handle(&self, command_name: &str) -> bool
Check if this handler can handle a command