Skip to main content

Handler

Trait Handler 

Source
pub trait Handler {
    type Output: Serialize;

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

    // Provided method
    fn expected_args(&self) -> Vec<ExpectedArg> { ... }
}

Required Associated Types§

Required Methods§

Source

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

Provided Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

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

Source§

impl<F, T, R> Handler for SimpleFnHandler<F, T, R>
where F: FnMut(&ArgMatches) -> R, R: IntoHandlerResult<T>, T: Serialize,