Add top-level tests for futures 0.2 integration (#231)

This commit is contained in:
Aaron Turon
2018-03-15 16:38:12 -07:00
committed by Carl Lerche
parent b7f4e337be
commit 7b1306e6c2
6 changed files with 353 additions and 0 deletions
+16
View File
@@ -139,6 +139,14 @@ impl TcpStream {
self.io.poll_read_ready(mask)
}
/// Like `poll_read_ready`, but compatible with futures 0.2
#[cfg(feature = "unstable-futures")]
pub fn poll_read_ready2(&self, cx: &mut futures2::task::Context, mask: mio::Ready)
-> futures2::Poll<mio::Ready, io::Error>
{
self.io.poll_read_ready2(cx, mask)
}
/// Check the TCP stream's write readiness state.
///
/// This always checks for writable readiness and also checks for HUP
@@ -160,6 +168,14 @@ impl TcpStream {
self.io.poll_write_ready()
}
/// Like `poll_write_ready`, but compatible with futures 0.2.
#[cfg(feature = "unstable-futures")]
pub fn poll_write_ready2(&self, cx: &mut futures2::task::Context)
-> futures2::Poll<mio::Ready, io::Error>
{
self.io.poll_write_ready2(cx)
}
/// Returns the local address that this stream is bound to.
pub fn local_addr(&self) -> io::Result<SocketAddr> {
self.io.get_ref().local_addr()