Trait httprouter::Handler [−][src]
pub trait Handler: Send + Sync { fn handle(
&self,
req: Request<Body>
) -> Pin<Box<dyn Future<Output = Result<Response<Body>>> + Send + Sync>>; }
Expand description
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
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
Loading content...