diff --git a/examples/connect.rs b/examples/connect.rs index 6e909b25e..836d7f8f2 100644 --- a/examples/connect.rs +++ b/examples/connect.rs @@ -92,7 +92,7 @@ mod tcp { mod udp { use bytes::Bytes; - use futures::{future, Sink, SinkExt, Stream, StreamExt}; + use futures::{Sink, SinkExt, Stream, StreamExt}; use std::error::Error; use std::io; use std::net::SocketAddr; @@ -114,7 +114,7 @@ mod udp { let socket = UdpSocket::bind(&bind_addr).await?; socket.connect(addr).await?; - future::try_join(send(stdin, &socket), recv(stdout, &socket)).await?; + tokio::try_join!(send(stdin, &socket), recv(stdout, &socket))?; Ok(()) } diff --git a/examples/echo.rs b/examples/echo.rs index d492e07e9..aece8dc65 100644 --- a/examples/echo.rs +++ b/examples/echo.rs @@ -55,7 +55,7 @@ async fn main() -> Result<(), Box> { // which will allow all of our clients to be processed concurrently. tokio::spawn(async move { - let mut buf = [0; 1024]; + let mut buf = vec![0; 1024]; // In a loop, read data from the socket and write the data back. loop { diff --git a/examples/proxy.rs b/examples/proxy.rs index 2d9b7ce3d..e5cd4b8b5 100644 --- a/examples/proxy.rs +++ b/examples/proxy.rs @@ -26,7 +26,6 @@ use tokio::io; use tokio::io::AsyncWriteExt; use tokio::net::{TcpListener, TcpStream}; -use futures::future::try_join; use futures::FutureExt; use std::env; use std::error::Error; @@ -74,7 +73,7 @@ async fn transfer(mut inbound: TcpStream, proxy_addr: String) -> Result<(), Box< wi.shutdown().await }; - try_join(client_to_server, server_to_client).await?; + tokio::try_join!(client_to_server, server_to_client)?; Ok(()) } diff --git a/examples/udp-codec.rs b/examples/udp-codec.rs index 7c305245b..c587be9ab 100644 --- a/examples/udp-codec.rs +++ b/examples/udp-codec.rs @@ -45,7 +45,7 @@ async fn main() -> Result<(), Box> { let b = pong(&mut b); // Run both futures simultaneously of `a` and `b` sending messages back and forth. - match futures::future::try_join(a, b).await { + match tokio::try_join!(a, b) { Err(e) => println!("an error occurred; error = {:?}", e), _ => println!("done!"), }