Skip to content

Commit e90f003

Browse files
weihangloseanmonstar
authored andcommitted
docs(client): HttpInfo doc test to async/await
1 parent e0c1090 commit e90f003

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/client/connect/http.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,23 @@ pub struct HttpConnector<R = GaiResolver> {
4646
/// # Example
4747
///
4848
/// ```
49+
/// # #![feature(async_await)]
50+
/// # async fn doc() -> hyper::Result<()> {
4951
/// use hyper::Uri;
5052
/// use hyper::client::{Client, connect::HttpInfo};
51-
/// use hyper::rt::Future;
5253
///
5354
/// let client = Client::new();
55+
/// let uri = Uri::from_static("http://example.com");
5456
///
55-
/// let fut = client.get(Uri::from_static("http://example.local"))
56-
/// .inspect(|resp| {
57-
/// resp
58-
/// .extensions()
59-
/// .get::<HttpInfo>()
60-
/// .map(|info| {
61-
/// println!("remote addr = {}", info.remote_addr());
62-
/// });
57+
/// let res = client.get(uri).await?;
58+
/// res
59+
/// .extensions()
60+
/// .get::<HttpInfo>()
61+
/// .map(|info| {
62+
/// println!("remote addr = {}", info.remote_addr());
6363
/// });
64+
/// # Ok(())
65+
/// # }
6466
/// ```
6567
///
6668
/// # Note

0 commit comments

Comments
 (0)