AsyncCommandHandler

Trait AsyncCommandHandler 

Source
pub trait AsyncCommandHandler:
    Send
    + Sync
    + 'static {
    // Required methods
    fn execute_async<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        app: &'life1 mut TerminalApp,
        args: &'life2 [&'life3 str],
    ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn box_clone(&self) -> Box<dyn AsyncCommandHandler>;
}
Expand description

Trait for asynchronous command handlers that can be registered with the terminal application.

All asynchronous commands must implement this trait to be executable within the terminal app. Handlers receive mutable access to the application state and command arguments.

Required Methods§

Source

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

Executes the command asynchronously with the given application state and arguments.

§Arguments
  • app - Mutable reference to the terminal application
  • args - Slice of command arguments
§Returns

String output to be displayed to the user

Source

fn box_clone(&self) -> Box<dyn AsyncCommandHandler>

Creates a boxed clone of this handler for reuse

Implementors§