Forked from trizinix/gist:8544b398003f7c84a88034ee44f29cb3
Created
January 4, 2017 19:56
-
-
Save 46bit/1b58666e611f7371e4db1efe8bf63b22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn writeall_stdout(socket: TcpStream) -> IoFuture<()> { | |
let iter = iter::repeat(()).map(|()| Ok(())); | |
stream::iter(iter).fold(socket, move |socket, ()| { | |
let buf = vec![0;1024]; | |
tokio_core::io::read(socket, buf).map(|(socket, _, num_bytes)| { | |
println!("Read {} bytes", num_bytes); | |
socket | |
}) | |
}).map(|_| ()).boxed() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment