Trait Service

Source
pub trait Service: Send + Sync {
    type Data: Send + Sync;

    // Required method
    fn handle<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        request: &'life1 Request,
        ctx: &'life2 Self::Data,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Response>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for async services that maybe handle a request.

Only available with the async feature.

Required Associated Types§

Source

type Data: Send + Sync

Type of the user data for this service.

Required Methods§

Source

fn handle<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request: &'life1 Request, ctx: &'life2 Self::Data, ) -> Pin<Box<dyn Future<Output = Result<Option<Response>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

See Service for more information.

Implementors§