Skip to content

Commit

Permalink
Use custom implementation of read_buf in Read for &'a FileDesc
Browse files Browse the repository at this point in the history
This allows to skip an unnecessary buffer initialization.
  • Loading branch information
tmiasko committed Feb 19, 2023
1 parent eebdfb5 commit b118569
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions library/std/src/sys/unix/fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ impl<'a> Read for &'a FileDesc {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
(**self).read(buf)
}

fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> {
(**self).read_buf(cursor)
}
}

impl AsInner<OwnedFd> for FileDesc {
Expand Down

0 comments on commit b118569

Please sign in to comment.