diff options
author | Carl Lerche <me@carllerche.com> | 2018-03-06 09:59:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-06 09:59:04 -0800 |
commit | f1cb12e14fb047f3f86c852c253962c60ce471e8 (patch) | |
tree | 59aab45a28961b00f7c71c5eb083c6242b51ff01 /examples/hello_world.rs | |
parent | 56c579787260abcb9786aa22cfca1ee4b7c3b5ba (diff) |
Update examples to track latest Tokio changes (#180)
The exampes included in the repository have lagged behind the changes
made. Specifically, they do not use the new runtime construct.
This patch updates examples to use the latest features of Tokio.
Diffstat (limited to 'examples/hello_world.rs')
-rw-r--r-- | examples/hello_world.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/examples/hello_world.rs b/examples/hello_world.rs index 1731f942..d8fef621 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -15,13 +15,10 @@ #![deny(warnings)] extern crate tokio; -extern crate tokio_io; -extern crate futures; -use tokio::executor::current_thread; +use tokio::io; use tokio::net::TcpListener; -use tokio_io::io; -use futures::{Future, Stream}; +use tokio::prelude::*; pub fn main() { let addr = "127.0.0.1:6142".parse().unwrap(); @@ -43,7 +40,7 @@ pub fn main() { }); // Spawn a new task that processes the socket: - current_thread::spawn(connection); + tokio::spawn(connection); Ok(()) }) @@ -76,5 +73,5 @@ pub fn main() { // // In our example, we have not defined a shutdown strategy, so this will // block until `ctrl-c` is pressed at the terminal. - current_thread::block_on_all(server).unwrap(); + tokio::run(server); } |