Skip to main content

CommandModule

Trait CommandModule 

Source
pub trait CommandModule<C> {
    // Required methods
    fn dispatch(&self, command: &str, context: C) -> Result<(), Error>;
    fn get_suggestions(&self, command: &str, context: &C) -> Vec<String>;
}
Expand description

Defines a command module, or a set of command definitions with an associated parser and suggestion generator.

Required Methods§

Source

fn dispatch(&self, command: &str, context: C) -> Result<(), Error>

Dispatches the given command for execution.

Source

fn get_suggestions(&self, command: &str, context: &C) -> Vec<String>

Generates a list of suggestions to complete the final argument in the given command.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§