summaryrefslogtreecommitdiffstats
path: root/examples/tinyhttp.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/tinyhttp.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/tinyhttp.rs')
-rw-r--r--examples/tinyhttp.rs11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/tinyhttp.rs b/examples/tinyhttp.rs
index f5513992..00c16fec 100644
--- a/examples/tinyhttp.rs
+++ b/examples/tinyhttp.rs
@@ -31,15 +31,15 @@ use std::net::{self, SocketAddr};
use std::thread;
use bytes::BytesMut;
-use futures::future;
use futures::future::Executor;
+use futures::future;
use futures::sync::mpsc;
use futures::{Stream, Future, Sink};
use futures_cpupool::CpuPool;
-use http::{Request, Response, StatusCode};
use http::header::HeaderValue;
+use http::{Request, Response, StatusCode};
use tokio::net::TcpStream;
-use tokio::reactor::Reactor;
+use tokio::reactor::Handle;
use tokio_io::codec::{Encoder, Decoder};
use tokio_io::{AsyncRead};
@@ -70,8 +70,7 @@ fn main() {
}
fn worker(rx: mpsc::UnboundedReceiver<net::TcpStream>) {
- let mut core = Reactor::new().unwrap();
- let handle = core.handle();
+ let handle = Handle::default();
let pool = CpuPool::new(1);
@@ -92,7 +91,7 @@ fn worker(rx: mpsc::UnboundedReceiver<net::TcpStream>) {
})).unwrap();
Ok(())
});
- core.run(done).unwrap();
+ done.wait().unwrap();
}
/// "Server logic" is implemented in this function.