diff --git a/src/tcp/stream.rs b/src/tcp/stream.rs index d9a4e1e7..a40384e5 100644 --- a/src/tcp/stream.rs +++ b/src/tcp/stream.rs @@ -525,6 +525,21 @@ impl AsyncWriteReady for TcpStream { } } +impl io::Read for TcpStream { + fn read(&mut self, buf: &mut [u8]) -> Result { + self.io.get_mut().read(buf) + } +} + +impl io::Write for TcpStream { + fn write(&mut self, buf: &[u8]) -> Result { + self.io.get_mut().write(buf) + } + fn flush(&mut self) -> Result<(), io::Error> { + self.io.get_mut().flush() + } +} + impl fmt::Debug for TcpStream { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.io.get_ref().fmt(f) diff --git a/src/uds/stream.rs b/src/uds/stream.rs index 0da94e37..14c166a8 100644 --- a/src/uds/stream.rs +++ b/src/uds/stream.rs @@ -248,6 +248,21 @@ impl TakeError for UnixStream { } } +impl io::Read for UnixStream { + fn read(&mut self, buf: &mut [u8]) -> Result { + self.io.get_mut().read(buf) + } +} + +impl io::Write for UnixStream { + fn write(&mut self, buf: &[u8]) -> Result { + self.io.get_mut().write(buf) + } + fn flush(&mut self) -> Result<(), io::Error> { + self.io.get_mut().flush() + } +} + impl fmt::Debug for UnixStream { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.io.get_ref().fmt(f)