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

    // Required methods
    fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>;
    fn call(&self, req: Request<ReqBody>) -> Self::Future;
}

Required Associated Types§

source

type RespBody: Body

source

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

source

type Future: Future<Output = Result<Response<Self::RespBody>, Self::Error>>

Required Methods§

source

fn poll_ready(&self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

source

fn call(&self, req: Request<ReqBody>) -> Self::Future

Implementors§

source§

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

§

type RespBody = RespBody

§

type Error = Err

§

type Future = Ret