From 1a991a1c90d60928268cbcf730e71c93663857ac Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 24 Nov 2023 15:00:12 -0500 Subject: [PATCH] docs(examples): touch up Hello server example --- examples/hello.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/hello.rs b/examples/hello.rs index d9d6b8c4c7..3a0948294a 100644 --- a/examples/hello.rs +++ b/examples/hello.rs @@ -10,13 +10,15 @@ use hyper::service::service_fn; use hyper::{Request, Response}; use tokio::net::TcpListener; +// This would normally come from the `hyper-util` crate, but we can't depend +// on that here because it would be a cyclical dependency. #[path = "../benches/support/mod.rs"] mod support; -use support::TokioIo; +use support::{TokioIo, TokioTimer}; // An async function that consumes a request, does nothing with it and returns a // response. -async fn hello(_: Request) -> Result>, Infallible> { +async fn hello(_: Request) -> Result>, Infallible> { Ok(Response::new(Full::new(Bytes::from("Hello World!")))) } @@ -51,6 +53,7 @@ pub async fn main() -> Result<(), Box> { // Handle the connection from the client using HTTP1 and pass any // HTTP requests received on that connection to the `hello` function if let Err(err) = http1::Builder::new() + .timer(TokioTimer) .serve_connection(io, service_fn(hello)) .await {