Skip to main content

Command

Trait Command 

Source
pub trait Command: Send + Sync {
    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn execute(&self, input: &Input) -> Result<(), ConsoleError>;
}
Expand description

A discoverable console command (foo:bar).

Required Methods§

Source

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

Stable command name (for example serenade:about).

Source

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

One-line help shown by list.

Source

fn execute(&self, input: &Input) -> Result<(), ConsoleError>

Runs the command.

§Errors

Returns ConsoleError when the command fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§