tui_commander

Trait Command

Source
pub trait Command<Context> {
    // Required methods
    fn name() -> &'static str
       where Self: Sized;
    fn build_from_command_name_str(
        input: &str,
    ) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>
       where Self: Sized;
    fn args_are_valid(args: &[&str]) -> bool
       where Self: Sized;
    fn execute(
        &self,
        arguments: Vec<String>,
        context: &mut Context,
    ) -> Result<(), Box<dyn Error + Send + Sync + 'static>>;
}

Required Methods§

Source

fn name() -> &'static str
where Self: Sized,

The name of the command, what a user has to type to find the command and execute

Source

fn build_from_command_name_str( input: &str, ) -> Result<Self, Box<dyn Error + Send + Sync + 'static>>
where Self: Sized,

Source

fn args_are_valid(args: &[&str]) -> bool
where Self: Sized,

Source

fn execute( &self, arguments: Vec<String>, context: &mut Context, ) -> Result<(), Box<dyn Error + Send + Sync + 'static>>

Implementors§