[−][src]Trait httprouter::Handler
Represents a HTTP handler function.
This trait is implemented for asynchronous functions that take a Request
and return a
Result<Response<Body>, hyper::Error>
async fn hello(_: Request<Body>) -> Result<Response<Body>, hyper::Error> { Ok(Response::new(Body::empty())) } let handler: Box<dyn Handler> = Box::new(hello);
Required methods
pub fn handle(
&self,
req: Request<Body>
) -> Pin<Box<dyn Future<Output = Result<Response<Body>>> + Send + Sync>>
[src]
&self,
req: Request<Body>
) -> Pin<Box<dyn Future<Output = Result<Response<Body>>> + Send + Sync>>
Implementors
impl<F, R> Handler for F where
F: Fn(Request<Body>) -> R + Send + Sync,
R: Future<Output = Result<Response<Body>, Error>> + Send + Sync + 'static,
[src]
F: Fn(Request<Body>) -> R + Send + Sync,
R: Future<Output = Result<Response<Body>, Error>> + Send + Sync + 'static,