diff options
author | Alex Crichton <alex@alexcrichton.com> | 2017-12-11 21:29:18 -0600 |
---|---|---|
committer | Carl Lerche <me@carllerche.com> | 2017-12-11 21:29:18 -0600 |
commit | a577bfc033b50c913c2241c432bcaeac3917145c (patch) | |
tree | 1151bc60d9f9373722d6bea9127b965a4db470bc /examples/connect.rs | |
parent | 32f2750c2d99e82d64033c5865d2f4e029cb31ac (diff) |
Remove the `Reactor::run` method (#58)
This commit removes the `Reactor::run` method which has previously been used to
execute futures and turn the reactor at the same time. The tests/examples made
heavy usage of this method but they have now all temporarily moved to `wait()`
until the futures dependency is upgraded. In the meantime this'll allow us to
further trim down the `Reactor` APIs to their final state.
Diffstat (limited to 'examples/connect.rs')
-rw-r--r-- | examples/connect.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/connect.rs b/examples/connect.rs index 235da1af..5cedadfb 100644 --- a/examples/connect.rs +++ b/examples/connect.rs @@ -28,7 +28,7 @@ use std::thread; use futures::sync::mpsc; use futures::{Sink, Future, Stream}; use futures_cpupool::CpuPool; -use tokio::reactor::Reactor; +use tokio::reactor::Handle; fn main() { // Determine if we're going to run in TCP or UDP mode @@ -47,9 +47,7 @@ fn main() { }); let addr = addr.parse::<SocketAddr>().unwrap(); - // Create the event loop and initiate the connection to the remote server - let mut core = Reactor::new().unwrap(); - let handle = core.handle(); + let handle = Handle::default(); let pool = CpuPool::new(1); @@ -76,9 +74,9 @@ fn main() { // loop. In this case, though, we know it's ok as the event loop isn't // otherwise running anything useful. let mut out = io::stdout(); - core.run(stdout.for_each(|chunk| { + stdout.for_each(|chunk| { out.write_all(&chunk) - })).unwrap(); + }).wait().unwrap(); } mod tcp { |