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.
This commit is contained in:
Alex Crichton
2017-12-11 21:29:18 -06:00
committed by Carl Lerche
parent 32f2750c2d
commit a577bfc033
23 changed files with 133 additions and 247 deletions
+3 -4
View File
@@ -31,7 +31,7 @@ use futures::stream::{self, Stream};
use futures_cpupool::CpuPool;
use tokio_io::IoFuture;
use tokio::net::{TcpListener, TcpStream};
use tokio::reactor::Reactor;
use tokio::reactor::Handle;
fn main() {
env_logger::init().unwrap();
@@ -40,8 +40,7 @@ fn main() {
let pool = CpuPool::new(1);
let mut core = Reactor::new().unwrap();
let handle = core.handle();
let handle = Handle::default();
let socket = TcpListener::bind(&addr, &handle).unwrap();
println!("Listening on: {}", addr);
let server = socket.incoming().for_each(|(socket, addr)| {
@@ -49,7 +48,7 @@ fn main() {
pool.execute(write(socket).or_else(|_| Ok(()))).unwrap();
Ok(())
});
core.run(server).unwrap();
server.wait().unwrap();
}
fn write(socket: TcpStream) -> IoFuture<()> {