Skip to main content

InputHandler

Trait InputHandler 

Source
pub trait InputHandler<Input, Output, State>: Send + Sync
where Input: Send + 'static, Output: Send + 'static, State: Send + Sync + 'static,
{ // Required methods fn name(&self) -> &str; fn can_handle(&self, input: &Input) -> bool; fn handle<'life0, 'life1, 'async_trait>( &'life0 self, input: Input, ctx: &'life1 mut SecretaryContext<State>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Output>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; }
Expand description

输入处理器Trait

用于处理特定类型的用户输入。可以注册多个处理器来处理不同类型的输入。

Required Methods§

Source

fn name(&self) -> &str

处理器名称

Source

fn can_handle(&self, input: &Input) -> bool

检查是否可以处理此输入

Source

fn handle<'life0, 'life1, 'async_trait>( &'life0 self, input: Input, ctx: &'life1 mut SecretaryContext<State>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Output>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

处理输入

Implementors§