Trait Handler

Source
pub trait Handler {
    type Error: Display;

    // Required method
    fn handle<'async_trait>(
        self,
        req: Request<IncomingBody>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Full<Bytes>>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

A handler that can be used by a Server. If the handler returns an error, the error will be logged and a 500 response will be returned to the client.

Required Associated Types§

Required Methods§

Source

fn handle<'async_trait>( self, req: Request<IncomingBody>, ) -> Pin<Box<dyn Future<Output = Result<Response<Full<Bytes>>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,

Implementors§

Source§

impl<F, Fut, E> Handler for F
where F: FnOnce(Request<Incoming>) -> Fut, Fut: Future<Output = Result<Response<Full<Bytes>>, E>> + Send + 'static, E: Display,

Source§

type Error = E