diff options
author | Andy Wortman <me@iximeow.net> | 2017-07-15 20:45:19 -0700 |
---|---|---|
committer | Andy Wortman <me@iximeow.net> | 2017-07-15 20:45:19 -0700 |
commit | b888282e1dc56cd7a63d88e9426488ab2772c0ef (patch) | |
tree | 72b76108179ae47ca7181a309f924fc144b8e48b | |
parent | ea47395001100144cda08884c614ddba0e8a034b (diff) |
with great healp from rschifflin this is way way way way way cleaner
(i gotta go back and look at futures::stream::iter and into_iter() vs iter())
and try doing this myself again until i can follow the types a lil better
-rw-r--r-- | main.rs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -121,6 +121,7 @@ fn main() { }; println!("requesting..."); + /* let work = client.request(req).and_then(|res| { res.body().for_each(move |body: hyper::Chunk| { println!("hmmm"); @@ -128,6 +129,13 @@ fn main() { Ok(()) }) }); + */ + + let work = client.request(req).and_then(|res| { + res.body() + .map(|chunk| futures::stream::iter(chunk.into_iter().map(|b| -> Result<u8, hyper::Error> { Ok(b) }))) + .flatten().for_each(|byte| Ok(print!("{}", byte as char))) + }); println!("Before?"); let resp = core.run(work).unwrap(); |