File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -191,30 +191,25 @@ where
191
191
/// # Example
192
192
///
193
193
/// ```
194
- /// # extern crate futures;
195
- /// # extern crate hyper;
196
- /// # extern crate http;
194
+ /// # #![feature(async_await)]
197
195
/// # use http::header::HOST;
198
196
/// # use hyper::client::conn::SendRequest;
199
197
/// # use hyper::Body;
200
- /// use futures::Future;
201
198
/// use hyper::Request;
202
199
///
203
- /// # fn doc(mut tx: SendRequest<Body>) {
200
+ /// # async fn doc(mut tx: SendRequest<Body>) -> hyper::Result<()> {
204
201
/// // build a Request
205
202
/// let req = Request::builder()
206
203
/// .uri("/foo/bar")
207
204
/// .header(HOST, "hyper.rs")
208
205
/// .body(Body::empty())
209
206
/// .unwrap();
210
207
///
211
- /// // send it and get a future back
212
- /// let fut = tx.send_request(req)
213
- /// .map(|res| {
214
- /// // got the Response
215
- /// assert!(res.status().is_success());
216
- /// });
217
- /// # drop(fut);
208
+ /// // send it and await a Response
209
+ /// let res = tx.send_request(req).await?;
210
+ /// // assert the Response
211
+ /// assert!(res.status().is_success());
212
+ /// # Ok(())
218
213
/// # }
219
214
/// # fn main() {}
220
215
/// ```
You can’t perform that action at this time.
0 commit comments