Skip to main content

BotHandlerFn

Trait BotHandlerFn 

Source
pub trait BotHandlerFn<S: BotState>: Send + Sync {
    // Required method
    fn run<'life0, 'async_trait>(
        &'life0 self,
        event: Event,
        state: State<S>,
    ) -> Pin<Box<dyn Future<Output = Result<Action, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

BotHandlerFns are async functions that take an Event and a State and return an Action

Required Methods§

Source

fn run<'life0, 'async_trait>( &'life0 self, event: Event, state: State<S>, ) -> Pin<Box<dyn Future<Output = Result<Action, Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Trait Implementations§

Source§

impl<S> From<Box<dyn BotHandlerFn<S>>> for Box<dyn BotHandler<S>>
where S: BotState,

Source§

fn from(func: Box<dyn BotHandlerFn<S>>) -> Box<dyn BotHandler<S>>

Converts to this type from the input type.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<S: BotState> BotHandlerFn<S> for AuthHandler

Source§

impl<S: BotState> BotHandlerFn<S> for Handler<S>

Implement the BotHandlerFn trait for Handler.

Source§

impl<S: BotState> BotHandlerFn<S> for HandlerFn<S>

Implement the BotHandlerFn trait for HandlerFn.