Trait CommandHandler

Source
pub trait CommandHandler: Send + Sync {
    type Args: Send + Sync;

    // Required methods
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        args: Self::Args,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn name(&self) -> &'static str;

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

Trait for command handlers

Required Associated Types§

Source

type Args: Send + Sync

Command arguments type

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, args: Self::Args, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Executes the command

Source

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

Command name

Provided Methods§

Source

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

Command description

Source

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

Command signature (for help)

Implementors§