pub trait LocalHandler {
type Output: Serialize;
// Required method
fn handle(
&mut self,
matches: &ArgMatches,
ctx: &CommandContext,
) -> HandlerResult<Self::Output>;
}Expand description
Trait for local (single-threaded) command handlers.
Unlike Handler, this trait:
- Does NOT require
Send + Sync - Takes
&mut selfinstead of&self - Allows handlers to mutate their internal state directly
Required Associated Types§
Required Methods§
Sourcefn handle(
&mut self,
matches: &ArgMatches,
ctx: &CommandContext,
) -> HandlerResult<Self::Output>
fn handle( &mut self, matches: &ArgMatches, ctx: &CommandContext, ) -> HandlerResult<Self::Output>
Execute the handler with the given matches and context.