Trait bonsaidb::server::api::Handler

source ·
pub trait Handler<Api, B = NoBackend>: Send + Syncwhere
    Api: Api,
    B: Backend,{
    // Required method
    fn handle<'life0, 'async_trait>(
        session: HandlerSession<'life0, B>,
        request: Api
    ) -> Pin<Box<dyn Future<Output = Result<<Api as Api>::Response, HandlerError<<Api as Api>::Error>>> + Send + 'async_trait, Global>>
       where 'life0: 'async_trait;
}
Expand description

A trait that can dispatch requests for a Api.

Required Methods§

source

fn handle<'life0, 'async_trait>( session: HandlerSession<'life0, B>, request: Api ) -> Pin<Box<dyn Future<Output = Result<<Api as Api>::Response, HandlerError<<Api as Api>::Error>>> + Send + 'async_trait, Global>>where 'life0: 'async_trait,

Returns a dispatcher to handle custom api requests. The parameters are provided so that they can be cloned if needed during the processing of requests.

Implementors§