@@ -257,6 +257,34 @@ impl<B: AsRef<[u8]> + 'static> Http<B> {
257257 ///
258258 /// This returns a Future that must be polled in order for HTTP to be
259259 /// driven on the connection.
260+ ///
261+ /// # Example
262+ ///
263+ /// ```
264+ /// # extern crate futures;
265+ /// # extern crate hyper;
266+ /// # extern crate tokio_core;
267+ /// # extern crate tokio_io;
268+ /// # use futures::Future;
269+ /// # use hyper::server::{Http, Request, Response, Service};
270+ /// # use tokio_io::{AsyncRead, AsyncWrite};
271+ /// # use tokio_core::reactor::Handle;
272+ /// # fn run<I, S>(some_io: I, some_service: S, some_handle: &Handle)
273+ /// # where
274+ /// # I: AsyncRead + AsyncWrite + 'static,
275+ /// # S: Service<Request=Request, Response=Response, Error=hyper::Error> + 'static,
276+ /// # {
277+ /// let http = Http::<hyper::Chunk>::new();
278+ /// let conn = http.serve_connection(some_io, some_service);
279+ ///
280+ /// let fut = conn
281+ /// .map(|_| ())
282+ /// .map_err(|e| eprintln!("server connection error: {}", e));
283+ ///
284+ /// some_handle.spawn(fut);
285+ /// # }
286+ /// # fn main() {}
287+ /// ```
260288 pub fn serve_connection < S , I , Bd > ( & self , io : I , service : S ) -> Connection < I , S >
261289 where S : Service < Request = Request , Response = Response < Bd > , Error = :: Error > ,
262290 Bd : Stream < Error =:: Error > ,
0 commit comments