@@ -331,31 +331,25 @@ impl<E> Http<E> {
331
331
/// # Example
332
332
///
333
333
/// ```
334
- /// # extern crate hyper;
335
- /// # extern crate tokio_io;
336
- /// # #[cfg(feature = "runtime")]
337
- /// # extern crate tokio;
334
+ /// # #![feature(async_await)]
338
335
/// # use hyper::{Body, Request, Response};
339
336
/// # use hyper::service::Service;
340
337
/// # use hyper::server::conn::Http;
338
+ /// # #[cfg(feature = "runtime")]
341
339
/// # use tokio_io::{AsyncRead, AsyncWrite};
342
340
/// # #[cfg(feature = "runtime")]
343
- /// # fn run<I, S>(some_io: I, some_service: S)
341
+ /// # async fn run<I, S>(some_io: I, some_service: S)
344
342
/// # where
345
- /// # I: AsyncRead + AsyncWrite + Send + 'static,
343
+ /// # I: AsyncRead + AsyncWrite + Unpin + Send + 'static,
346
344
/// # S: Service<ReqBody=Body, ResBody=Body> + Send + 'static,
347
345
/// # S::Future: Send
348
346
/// # {
349
- /// # use hyper::rt::Future;
350
- /// # use tokio::reactor::Handle;
351
347
/// let http = Http::new();
352
348
/// let conn = http.serve_connection(some_io, some_service);
353
349
///
354
- /// let fut = conn.map_err(|e| {
350
+ /// if let Err(e) = conn.await {
355
351
/// eprintln!("server connection error: {}", e);
356
- /// });
357
- ///
358
- /// hyper::rt::spawn(fut);
352
+ /// }
359
353
/// # }
360
354
/// # fn main() {}
361
355
/// ```
0 commit comments