pub trait Handler {
type Event: Serialize + 'static;
type Output: Serialize;
type Outcome: HandlerOutcome<Self::Output, Self::Event>;
// Required method
fn handle(
&mut self,
matches: &ArgMatches,
ctx: &CommandContext,
results: &mut Results<Self::Event>,
) -> Result<Self::Outcome, Error>;
// Provided method
fn expected_args(&self) -> Vec<ExpectedArg> { ... }
}Required Associated Types§
Sourcetype Event: Serialize + 'static
type Event: Serialize + 'static
The type of the values the command produces while it runs, or
NoEvents for a command that produces none, which is what
emits_events reads.
type Output: Serialize
Sourcetype Outcome: HandlerOutcome<Self::Output, Self::Event>
type Outcome: HandlerOutcome<Self::Output, Self::Event>
Output for a batch command, Summary for one that declares
events: HandlerOutcome admits the first only under NoEvents.
Required Methods§
fn handle( &mut self, matches: &ArgMatches, ctx: &CommandContext, results: &mut Results<Self::Event>, ) -> Result<Self::Outcome, Error>
Provided Methods§
fn expected_args(&self) -> Vec<ExpectedArg>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".