Re-work I/O

* Auto-register interest whenever we see WouldBlock
* Remove implementations of `Stream<Item=Ready>`, no longer needed
* Add explicit `poll_{read,write}` methods, if needed
* Remove all I/O streams, libstd ones suffice
* Update all I/O futures
This commit is contained in:
Alex Crichton
2016-08-17 18:41:34 -07:00
parent 293d104177
commit d0b911189c
13 changed files with 367 additions and 230 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
use std::io;
use std::time::{Duration, Instant};
use futures::{Future, Task, Poll};
use futures::{Future, Poll};
use futures_io::IoFuture;
use LoopHandle;
@@ -50,12 +50,12 @@ impl Future for Timeout {
type Item = ();
type Error = io::Error;
fn poll(&mut self, task: &mut Task) -> Poll<(), io::Error> {
fn poll(&mut self) -> Poll<(), io::Error> {
// TODO: is this fast enough?
if self.at <= Instant::now() {
Poll::Ok(())
} else {
self.handle.update_timeout(&self.token, task);
self.handle.update_timeout(&self.token);
Poll::NotReady
}
}