Skip to content
Merged
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
62 changes: 62 additions & 0 deletions library/std/src/io/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ impl<R: Read + ?Sized> Read for &mut R {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
(**self).read_exact(buf)
}

#[inline]
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> {
(**self).read_buf_exact(cursor)
Expand Down Expand Up @@ -77,6 +78,11 @@ impl<W: Write + ?Sized> Write for &mut W {
(**self).write_all(buf)
}

#[inline]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
(**self).write_all_vectored(bufs)
}

#[inline]
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
(**self).write_fmt(fmt)
Expand All @@ -89,10 +95,25 @@ impl<S: Seek + ?Sized> Seek for &mut S {
(**self).seek(pos)
}

#[inline]
fn rewind(&mut self) -> io::Result<()> {
(**self).rewind()
}

#[inline]
fn stream_len(&mut self) -> io::Result<u64> {
(**self).stream_len()
}

#[inline]
fn stream_position(&mut self) -> io::Result<u64> {
(**self).stream_position()
}

#[inline]
fn seek_relative(&mut self, offset: i64) -> io::Result<()> {
(**self).seek_relative(offset)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<B: BufRead + ?Sized> BufRead for &mut B {
Expand All @@ -106,11 +127,21 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
(**self).consume(amt)
}

#[inline]
fn has_data_left(&mut self) -> io::Result<bool> {
(**self).has_data_left()
}

#[inline]
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> {
(**self).read_until(byte, buf)
}

#[inline]
fn skip_until(&mut self, byte: u8) -> io::Result<usize> {
(**self).skip_until(byte)
}

#[inline]
fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_line(buf)
Expand Down Expand Up @@ -153,6 +184,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
(**self).read_exact(buf)
}

#[inline]
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> {
(**self).read_buf_exact(cursor)
Expand Down Expand Up @@ -185,6 +217,11 @@ impl<W: Write + ?Sized> Write for Box<W> {
(**self).write_all(buf)
}

#[inline]
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
(**self).write_all_vectored(bufs)
}

#[inline]
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
(**self).write_fmt(fmt)
Expand All @@ -197,10 +234,25 @@ impl<S: Seek + ?Sized> Seek for Box<S> {
(**self).seek(pos)
}

#[inline]
fn rewind(&mut self) -> io::Result<()> {
(**self).rewind()
}

#[inline]
fn stream_len(&mut self) -> io::Result<u64> {
(**self).stream_len()
}

#[inline]
fn stream_position(&mut self) -> io::Result<u64> {
(**self).stream_position()
}

#[inline]
fn seek_relative(&mut self, offset: i64) -> io::Result<()> {
(**self).seek_relative(offset)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<B: BufRead + ?Sized> BufRead for Box<B> {
Expand All @@ -214,11 +266,21 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
(**self).consume(amt)
}

#[inline]
fn has_data_left(&mut self) -> io::Result<bool> {
(**self).has_data_left()
}

#[inline]
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> {
(**self).read_until(byte, buf)
}

#[inline]
fn skip_until(&mut self, byte: u8) -> io::Result<usize> {
(**self).skip_until(byte)
}

#[inline]
fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
(**self).read_line(buf)
Expand Down
Loading