docs(client): HttpInfo doc test to async/await
This commit is contained in:
committed by
Sean McArthur
parent
e0c1090ca7
commit
e90f0037d3
@@ -46,21 +46,23 @@ pub struct HttpConnector<R = GaiResolver> {
|
|||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// # #![feature(async_await)]
|
||||||
|
/// # async fn doc() -> hyper::Result<()> {
|
||||||
/// use hyper::Uri;
|
/// use hyper::Uri;
|
||||||
/// use hyper::client::{Client, connect::HttpInfo};
|
/// use hyper::client::{Client, connect::HttpInfo};
|
||||||
/// use hyper::rt::Future;
|
|
||||||
///
|
///
|
||||||
/// let client = Client::new();
|
/// let client = Client::new();
|
||||||
|
/// let uri = Uri::from_static("http://example.com");
|
||||||
///
|
///
|
||||||
/// let fut = client.get(Uri::from_static("http://example.local"))
|
/// let res = client.get(uri).await?;
|
||||||
/// .inspect(|resp| {
|
/// res
|
||||||
/// resp
|
|
||||||
/// .extensions()
|
/// .extensions()
|
||||||
/// .get::<HttpInfo>()
|
/// .get::<HttpInfo>()
|
||||||
/// .map(|info| {
|
/// .map(|info| {
|
||||||
/// println!("remote addr = {}", info.remote_addr());
|
/// println!("remote addr = {}", info.remote_addr());
|
||||||
/// });
|
/// });
|
||||||
/// });
|
/// # Ok(())
|
||||||
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// # Note
|
/// # Note
|
||||||
|
|||||||
Reference in New Issue
Block a user