Skip to main content

CommandHandler

Trait CommandHandler 

Source
pub trait CommandHandler: Send + Sync {
    // Required method
    fn execute(&self, args: &str) -> Result<String, AppError>;
}
Expand description

Handler for a single slash command.

Required Methods§

Source

fn execute(&self, args: &str) -> Result<String, AppError>

Execute the command with the given arguments string.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> CommandHandler for F
where F: Fn(&str) -> Result<String, AppError> + Send + Sync,

Blanket implementation: any Fn(&str) -> Result<String, AppError> can be used as a handler.