Skip to main content

CommandFactory

Trait CommandFactory 

Source
pub trait CommandFactory<'a> {
    // Required method
    fn create_command(
        &self,
        args: &ArgMatches,
        logger: &'a Logger,
    ) -> TiffResult<Box<dyn Command + 'a>>;
}
Expand description

Factory for creating commands from CLI arguments

This trait defines the interface for command factories which can parse CLI arguments and create the appropriate Command.

Required Methods§

Source

fn create_command( &self, args: &ArgMatches, logger: &'a Logger, ) -> TiffResult<Box<dyn Command + 'a>>

Create a new Command instance based on CLI arguments

§Arguments
  • args - CLI argument matches from clap
  • logger - Logger for recording operations
§Returns

A command that implements the Command trait, or an error

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§