CommandHandler

Trait CommandHandler 

Source
pub trait CommandHandler: Send + Sync {
    type Error: Error;

    // Required methods
    fn args() -> Command
       where Self: Sized;
    fn call(
        self,
        args: ArgMatches,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Expand description

The CommandHandler utilizes axum functionality to allow you to write a command handler which can utilize all your services with the same and easy way as you are used to from axum web handlers.

Required Associated Types§

Required Methods§

Source

fn args() -> Command
where Self: Sized,

Return your commands definition using clap

Source

fn call( self, args: ArgMatches, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Execute the command

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§