Command

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;

    // Provided methods
    fn execute<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        args: &'life1 [&'life2 str],
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn execute_sync(&self, args: &[&str]) -> Result<String> { ... }
    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

Provided Methods§

Source

fn execute<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, args: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

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

Source

fn priority(&self) -> u8

Source

fn is_available(&self) -> bool

Trait Implementations§

Source§

impl<T: Command> From<T> for Box<dyn Command>

Source§

fn from(cmd: T) -> Self

Converts to this type from the input type.

Implementors§