diff options
author | Alex Crichton <alex@alexcrichton.com> | 2017-08-24 08:16:04 -0700 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2017-08-24 08:16:04 -0700 |
commit | e8617ea1fc0bbe8d06b785d8ce68aa2663ede2d7 (patch) | |
tree | 68cc274320b731faa001c99dff89deb0f4e33cd6 /examples | |
parent | 77d9a1aa4f536bbf7aa0217cc779be9508c2b7b4 (diff) |
Update futures dependency
Diffstat (limited to 'examples')
-rw-r--r-- | examples/chat.rs | 6 | ||||
-rw-r--r-- | examples/sink.rs | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/examples/chat.rs b/examples/chat.rs index 267e0aa6..0e05c8ad 100644 --- a/examples/chat.rs +++ b/examples/chat.rs @@ -68,7 +68,7 @@ fn main() { // Model the read portion of this socket by mapping an infinite // iterator to each line off the socket. This "loop" is then // terminated with an error once we hit EOF on the socket. - let iter = stream::iter(iter::repeat(()).map(Ok::<(), Error>)); + let iter = stream::iter_ok::<_, Error>(iter::repeat(())); let socket_reader = iter.fold(reader, move |reader, _| { // Read a line off the socket, failing if we're at EOF let line = io::read_until(reader, b'\n', Vec::new()); @@ -96,11 +96,11 @@ fn main() { .filter(|&(&k, _)| k != addr) .map(|(_, v)| v); for tx in iter { - tx.send(format!("{}: {}", addr, msg)).unwrap(); + tx.unbounded_send(format!("{}: {}", addr, msg)).unwrap(); } } else { let tx = conns.get_mut(&addr).unwrap(); - tx.send("You didn't send valid UTF-8.".to_string()).unwrap(); + tx.unbounded_send("You didn't send valid UTF-8.".to_string()).unwrap(); } reader }) diff --git a/examples/sink.rs b/examples/sink.rs index 2998b269..bd56001f 100644 --- a/examples/sink.rs +++ b/examples/sink.rs @@ -50,8 +50,8 @@ fn main() { fn write(socket: TcpStream) -> IoFuture<()> { static BUF: &'static [u8] = &[0; 64 * 1024]; - let iter = iter::repeat(()).map(|()| Ok(())); - stream::iter(iter).fold(socket, |socket, ()| { + let iter = iter::repeat(()); + Box::new(stream::iter_ok(iter).fold(socket, |socket, ()| { tokio_io::io::write_all(socket, BUF).map(|(socket, _)| socket) - }).map(|_| ()).boxed() + }).map(|_| ())) } |