pub trait Handler: Send + Sync {
    type RespBody: Body;
    type Error: Into<Box<dyn Error + Send + Sync>>;
    type Fut<'fut>: Future<Output = Result<Response<Self::RespBody>, Self::Error>>
       where Self: 'fut;

    // Required method
    fn call(&self, req: Request<ReqBody>) -> Self::Fut<'_>;
}

Required Associated Types§

source

type RespBody: Body

source

type Error: Into<Box<dyn Error + Send + Sync>>

source

type Fut<'fut>: Future<Output = Result<Response<Self::RespBody>, Self::Error>> where Self: 'fut

Required Methods§

source

fn call(&self, req: Request<ReqBody>) -> Self::Fut<'_>

Implementors§

source§

impl<RespBody, Err, F, Fut> Handler for HandlerFn<F>where RespBody: Body, F: Fn(Request<ReqBody>) -> Fut + Send + Sync, Err: Into<Box<dyn Error + Send + Sync>>, Fut: Future<Output = Result<Response<RespBody>, Err>> + Send,

§

type RespBody = RespBody

§

type Error = Err

§

type Fut<'fut> where Self: 'fut = Fut