Trait Command

Source
pub trait Command:
    Send
    + Sync
    + Debug
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn description(&self) -> &'static str;
    fn matches(&self, command: &str) -> bool;
    fn execute_sync(&self, args: &[&str]) -> Result<String>;

    // Provided methods
    fn execute_async<'a>(
        &'a self,
        args: &'a [&'a str],
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>> { ... }
    fn supports_async(&self) -> bool { ... }
    fn priority(&self) -> u8 { ... }
    fn is_available(&self) -> bool { ... }
}

Required Methods§

Source

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

Source

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

Source

fn matches(&self, command: &str) -> bool

Source

fn execute_sync(&self, args: &[&str]) -> Result<String>

Provided Methods§

Source

fn execute_async<'a>( &'a self, args: &'a [&'a str], ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'a>>

Source

fn supports_async(&self) -> bool

Source

fn priority(&self) -> u8

Source

fn is_available(&self) -> bool

Implementors§