Skip to main content

Handler

Trait Handler 

Source
pub trait Handler: Send + Sync {
    type Output: Serialize;

    // Required method
    fn handle(
        &self,
        matches: &ArgMatches,
        ctx: &CommandContext,
    ) -> HandlerResult<Self::Output>;
}
Expand description

Trait for thread-safe command handlers.

Handlers must be Send + Sync and use immutable &self.

Required Associated Types§

Source

type Output: Serialize

The output type produced by this handler (must be serializable)

Required Methods§

Source

fn handle( &self, matches: &ArgMatches, ctx: &CommandContext, ) -> HandlerResult<Self::Output>

Execute the handler with the given matches and context.

Implementors§

Source§

impl<F, T> Handler for FnHandler<F, T>