pub type AsyncHandlerFn = Arc<dyn for<'a> Fn(&'a ParsedCommand<'a>) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn Error + Send + Sync>>> + Send + 'a>> + Send + Sync>;Expand description
An async handler function that can be registered on a Command.
The function receives a ParsedCommand reference and returns a
pinned, boxed future. Use Command::builder → CommandBuilder::async_handler
to register one.
§Feature
Requires the async feature flag.
§Examples
use std::sync::Arc;
use argot_cmd::AsyncHandlerFn;
let handler: AsyncHandlerFn = Arc::new(|parsed| Box::pin(async move {
println!("async command: {}", parsed.command.canonical);
Ok(())
}));Aliased Type§
pub struct AsyncHandlerFn { /* private fields */ }