Skip to main content

serenade_console/
command.rs

1//! Command trait.
2
3use crate::{ConsoleError, Input};
4
5/// A discoverable console command (`foo:bar`).
6pub trait Command: Send + Sync {
7    /// Stable command name (for example `serenade:about`).
8    fn name(&self) -> &'static str;
9
10    /// One-line help shown by `list`.
11    fn description(&self) -> &'static str;
12
13    /// Runs the command.
14    ///
15    /// # Errors
16    ///
17    /// Returns [`ConsoleError`] when the command fails.
18    fn execute(&self, input: &Input) -> Result<(), ConsoleError>;
19}