summaryrefslogtreecommitdiffstats
path: root/async-await/src/echo_client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'async-await/src/echo_client.rs')
-rw-r--r--async-await/src/echo_client.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/async-await/src/echo_client.rs b/async-await/src/echo_client.rs
index 7cab4932..302b7ea2 100644
--- a/async-await/src/echo_client.rs
+++ b/async-await/src/echo_client.rs
@@ -1,6 +1,6 @@
#![feature(await_macro, async_await)]
-use tokio::await;
+use tokio::async_wait;
use tokio::net::TcpStream;
use tokio::prelude::*;
@@ -14,7 +14,7 @@ const MESSAGES: &[&str] = &[
];
async fn run_client(addr: &SocketAddr) -> io::Result<()> {
- let mut stream = await!(TcpStream::connect(addr))?;
+ let mut stream = async_wait!(TcpStream::connect(addr))?;
// Buffer to read into
let mut buf = [0; 128];
@@ -23,10 +23,10 @@ async fn run_client(addr: &SocketAddr) -> io::Result<()> {
println!(" > write = {:?}", msg);
// Write the message to the server
- await!(stream.write_all_async(msg.as_bytes()))?;
+ async_wait!(stream.write_all_async(msg.as_bytes()))?;
// Read the message back from the server
- await!(stream.read_exact_async(&mut buf[..msg.len()]))?;
+ async_wait!(stream.read_exact_async(&mut buf[..msg.len()]))?;
assert_eq!(&buf[..msg.len()], msg.as_bytes());
}
@@ -43,7 +43,7 @@ async fn main() {
// Connect to the echo serveer
- match await!(run_client(&addr)) {
+ match async_wait!(run_client(&addr)) {
Ok(_) => println!("done."),
Err(e) => eprintln!("echo client failed; error = {:?}", e),
}