mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
Update with Poll/Async changes
This commit is contained in:
+1
-1
@@ -75,7 +75,7 @@ impl<R, W> Future for Copy<R, W>
|
||||
// done with the entire transfer.
|
||||
if self.pos == self.cap && self.read_done {
|
||||
try_nb!(self.writer.flush());
|
||||
return Poll::Ok(self.amt)
|
||||
return Ok(self.amt.into())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
use std::io::{self, Write};
|
||||
|
||||
use futures::{Poll, Future};
|
||||
use futures::{Poll, Future, Async};
|
||||
|
||||
/// A future used to fully flush an I/O object.
|
||||
///
|
||||
@@ -33,7 +33,7 @@ impl<A> Future for Flush<A>
|
||||
|
||||
fn poll(&mut self) -> Poll<A, io::Error> {
|
||||
try_nb!(self.a.as_mut().unwrap().flush());
|
||||
Poll::Ok(self.a.take().unwrap())
|
||||
Ok(Async::Ready(self.a.take().unwrap()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -25,9 +25,9 @@ macro_rules! try_nb {
|
||||
($e:expr) => (match $e {
|
||||
Ok(t) => t,
|
||||
Err(ref e) if e.kind() == ::std::io::ErrorKind::WouldBlock => {
|
||||
return ::futures::Poll::NotReady
|
||||
return Ok(::futures::Async::NotReady)
|
||||
}
|
||||
Err(e) => return ::futures::Poll::Err(e.into()),
|
||||
Err(e) => return Err(e.into()),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ impl<A, T> Future for ReadExact<A, T>
|
||||
let n = try_nb!(a.read(&mut buf[*pos..]));
|
||||
*pos += n;
|
||||
if n == 0 {
|
||||
return Poll::Err(eof())
|
||||
return Err(eof())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ impl<A, T> Future for ReadExact<A, T>
|
||||
}
|
||||
|
||||
match mem::replace(&mut self.state, State::Empty) {
|
||||
State::Reading { a, buf, .. } => Poll::Ok((a, buf)),
|
||||
State::Reading { a, buf, .. } => Ok((a, buf).into()),
|
||||
State::Empty => panic!(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ impl<A> Future for ReadToEnd<A>
|
||||
}
|
||||
|
||||
match mem::replace(&mut self.state, State::Empty) {
|
||||
State::Reading { a, buf } => Poll::Ok((a, buf)),
|
||||
State::Reading { a, buf } => Ok((a, buf).into()),
|
||||
State::Empty => unreachable!(),
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ impl<A, T> Future for WriteAll<A, T>
|
||||
let n = try_nb!(a.write(&buf[*pos..]));
|
||||
*pos += n;
|
||||
if n == 0 {
|
||||
return Poll::Err(zero_write())
|
||||
return Err(zero_write())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +73,7 @@ impl<A, T> Future for WriteAll<A, T>
|
||||
}
|
||||
|
||||
match mem::replace(&mut self.state, State::Empty) {
|
||||
State::Writing { a, buf, .. } => Poll::Ok((a, buf)),
|
||||
State::Writing { a, buf, .. } => Ok((a, buf).into()),
|
||||
State::Empty => panic!(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user