summaryrefslogtreecommitdiffstats
path: root/examples/tinydb.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-12-11 21:29:18 -0600
committerCarl Lerche <me@carllerche.com>2017-12-11 21:29:18 -0600
commita577bfc033b50c913c2241c432bcaeac3917145c (patch)
tree1151bc60d9f9373722d6bea9127b965a4db470bc /examples/tinydb.rs
parent32f2750c2d99e82d64033c5865d2f4e029cb31ac (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/tinydb.rs')
-rw-r--r--examples/tinydb.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/tinydb.rs b/examples/tinydb.rs
index 9929e369..7b5c47d1 100644
--- a/examples/tinydb.rs
+++ b/examples/tinydb.rs
@@ -54,7 +54,7 @@ use futures::prelude::*;
use futures::future::Executor;
use futures_cpupool::CpuPool;
use tokio::net::TcpListener;
-use tokio::reactor::Reactor;
+use tokio::reactor::Handle;
use tokio_io::AsyncRead;
use tokio_io::io::{lines, write_all};
@@ -80,12 +80,11 @@ enum Response {
}
fn main() {
- // Parse the address we're going to run this server on, create a `Reactor`, and
- // set up our TCP listener to accept connections.
+ // Parse the address we're going to run this server on
+ // and set up our TCP listener to accept connections.
let addr = env::args().nth(1).unwrap_or("127.0.0.1:8080".to_string());
let addr = addr.parse::<SocketAddr>().unwrap();
- let mut core = Reactor::new().unwrap();
- let handle = core.handle();
+ let handle = Handle::default();
let listener = TcpListener::bind(&addr, &handle).expect("failed to bind");
println!("Listening on: {}", addr);
@@ -163,7 +162,7 @@ fn main() {
Ok(())
});
- core.run(done).unwrap();
+ done.wait().unwrap();
}
impl Request {