Skip to content
This repository was archived by the owner on Nov 7, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/tcp/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,21 @@ impl AsyncWriteReady for TcpStream {
}
}

impl io::Read for TcpStream {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error> {
self.io.get_mut().read(buf)
}
}

impl io::Write for TcpStream {
fn write(&mut self, buf: &[u8]) -> Result<usize, io::Error> {
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)
Expand Down
15 changes: 15 additions & 0 deletions src/uds/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ impl TakeError for UnixStream {
}
}

impl io::Read for UnixStream {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error> {
self.io.get_mut().read(buf)
}
}

impl io::Write for UnixStream {
fn write(&mut self, buf: &[u8]) -> Result<usize, io::Error> {
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)
Expand Down