Trait CliTool

Source
pub trait CliTool<T: Serialize + Send>:
    Sized
    + Send
    + Parser {
    // Required method
    fn execute<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = CliTypedResult<T>> + Send + 'async_trait>>
       where Self: 'async_trait;

    // Provided methods
    fn execute_serialized<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = CliResult> + Send + 'async_trait>>
       where Self: 'async_trait { ... }
    fn execute_serialized_success<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = CliResult> + Send + 'async_trait>>
       where Self: 'async_trait { ... }
    fn execute_main<'async_trait>(    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait { ... }
}
Expand description

A common trait for all CLI commands to have consistent outputs

Required Methods§

Source

fn execute<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = CliTypedResult<T>> + Send + 'async_trait>>
where Self: 'async_trait,

Executes the command, returning a command specific type

Provided Methods§

Source

fn execute_serialized<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = CliResult> + Send + 'async_trait>>
where Self: 'async_trait,

Executes the command, and serializes it to the common JSON output type

Source

fn execute_serialized_success<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = CliResult> + Send + 'async_trait>>
where Self: 'async_trait,

Executes the command, and throws away Ok(result) for the string Success

Source

fn execute_main<'async_trait>() -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Executes the main function.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§