Skip to main content

Service

Trait Service 

Source
pub trait Service: Send + Sync {
    // Required method
    fn serve<'life0, 'async_trait>(
        &'life0 self,
        context: BotContext,
        event: BotEvent,
    ) -> Pin<Box<dyn Future<Output = HandlerControl> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn init<'life0, 'async_trait>(
        &'life0 self,
        bot: BotContext,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Source

fn serve<'life0, 'async_trait>( &'life0 self, context: BotContext, event: BotEvent, ) -> Pin<Box<dyn Future<Output = HandlerControl> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Extractors are not possible to be used in services but you can call FromEvent::from_event manually.

Provided Methods§

Source

fn init<'life0, 'async_trait>( &'life0 self, bot: BotContext, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§