pub trait CommandHandler: Send + Sync {
// Required method
fn execute(&self, args: &str) -> Result<CommandResult>;
// Provided method
fn argument_completions(&self, _prefix: &str) -> Vec<AutocompleteItem> { ... }
}Expand description
A slash command handler (built-in or extension-provided). Commands use the same Extension trait as tools - built-ins and user extensions register commands through a uniform interface.
Required Methods§
Sourcefn execute(&self, args: &str) -> Result<CommandResult>
fn execute(&self, args: &str) -> Result<CommandResult>
Execute the command with the given arguments string.
Provided Methods§
Sourcefn argument_completions(&self, _prefix: &str) -> Vec<AutocompleteItem>
fn argument_completions(&self, _prefix: &str) -> Vec<AutocompleteItem>
Get argument completions for autocomplete.
Called when user types /cmd - returns matching autocomplete items.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".