From c3ea11e82d856817d123ea4a9a9d3576b17817a7 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Tue, 17 Jul 2018 22:59:24 +0300 Subject: First round of runtime refactoring --- src/upnp.rs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/upnp.rs') diff --git a/src/upnp.rs b/src/upnp.rs index 7a228b6..8eeac00 100644 --- a/src/upnp.rs +++ b/src/upnp.rs @@ -49,26 +49,18 @@ fn fetch_url(url: hyper::Uri) -> impl Future { let client = Client::new(); client - // Fetch the url... .get(url) - // And then, if we get a response back... .and_then(|res| { println!("Response: {}", res.status()); println!("Headers: {:#?}", res.headers()); - - // The body is a stream, and for_each returns a new Future - // when the stream is finished, and calls the closure on - // each chunk of the body... res.into_body().for_each(|chunk| { io::stdout().write_all(&chunk) .map_err(|e| panic!("example expects stdout is open, error={}", e)) }) }) - // If all good, just tell the user... .map(|_| { println!("\n\nDone."); }) - // If there was an error, let the user know... .map_err(|err| { eprintln!("Error {}", err); }) -- cgit v1.3.1