Skip to content

Commit e60faad

Browse files
authored
Unrolled build for rust-lang#137062
Rollup merge of rust-lang#137062 - thaliaarchi:io-optional-methods/write, r=workingjubilee Forward all default methods for I/O impls Forward all default methods for `&mut T` and `Box<T>` to the inner `io::Read`, `io::Write`, `io::Seek`, and `io::BufRead` types.
2 parents f77247a + 11c1740 commit e60faad

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

library/std/src/io/impls.rs

+62
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ impl<R: Read + ?Sized> Read for &mut R {
4545
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
4646
(**self).read_exact(buf)
4747
}
48+
4849
#[inline]
4950
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> {
5051
(**self).read_buf_exact(cursor)
@@ -77,6 +78,11 @@ impl<W: Write + ?Sized> Write for &mut W {
7778
(**self).write_all(buf)
7879
}
7980

81+
#[inline]
82+
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
83+
(**self).write_all_vectored(bufs)
84+
}
85+
8086
#[inline]
8187
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
8288
(**self).write_fmt(fmt)
@@ -89,10 +95,25 @@ impl<S: Seek + ?Sized> Seek for &mut S {
8995
(**self).seek(pos)
9096
}
9197

98+
#[inline]
99+
fn rewind(&mut self) -> io::Result<()> {
100+
(**self).rewind()
101+
}
102+
103+
#[inline]
104+
fn stream_len(&mut self) -> io::Result<u64> {
105+
(**self).stream_len()
106+
}
107+
92108
#[inline]
93109
fn stream_position(&mut self) -> io::Result<u64> {
94110
(**self).stream_position()
95111
}
112+
113+
#[inline]
114+
fn seek_relative(&mut self, offset: i64) -> io::Result<()> {
115+
(**self).seek_relative(offset)
116+
}
96117
}
97118
#[stable(feature = "rust1", since = "1.0.0")]
98119
impl<B: BufRead + ?Sized> BufRead for &mut B {
@@ -106,11 +127,21 @@ impl<B: BufRead + ?Sized> BufRead for &mut B {
106127
(**self).consume(amt)
107128
}
108129

130+
#[inline]
131+
fn has_data_left(&mut self) -> io::Result<bool> {
132+
(**self).has_data_left()
133+
}
134+
109135
#[inline]
110136
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> {
111137
(**self).read_until(byte, buf)
112138
}
113139

140+
#[inline]
141+
fn skip_until(&mut self, byte: u8) -> io::Result<usize> {
142+
(**self).skip_until(byte)
143+
}
144+
114145
#[inline]
115146
fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
116147
(**self).read_line(buf)
@@ -153,6 +184,7 @@ impl<R: Read + ?Sized> Read for Box<R> {
153184
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
154185
(**self).read_exact(buf)
155186
}
187+
156188
#[inline]
157189
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> io::Result<()> {
158190
(**self).read_buf_exact(cursor)
@@ -185,6 +217,11 @@ impl<W: Write + ?Sized> Write for Box<W> {
185217
(**self).write_all(buf)
186218
}
187219

220+
#[inline]
221+
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> io::Result<()> {
222+
(**self).write_all_vectored(bufs)
223+
}
224+
188225
#[inline]
189226
fn write_fmt(&mut self, fmt: fmt::Arguments<'_>) -> io::Result<()> {
190227
(**self).write_fmt(fmt)
@@ -197,10 +234,25 @@ impl<S: Seek + ?Sized> Seek for Box<S> {
197234
(**self).seek(pos)
198235
}
199236

237+
#[inline]
238+
fn rewind(&mut self) -> io::Result<()> {
239+
(**self).rewind()
240+
}
241+
242+
#[inline]
243+
fn stream_len(&mut self) -> io::Result<u64> {
244+
(**self).stream_len()
245+
}
246+
200247
#[inline]
201248
fn stream_position(&mut self) -> io::Result<u64> {
202249
(**self).stream_position()
203250
}
251+
252+
#[inline]
253+
fn seek_relative(&mut self, offset: i64) -> io::Result<()> {
254+
(**self).seek_relative(offset)
255+
}
204256
}
205257
#[stable(feature = "rust1", since = "1.0.0")]
206258
impl<B: BufRead + ?Sized> BufRead for Box<B> {
@@ -214,11 +266,21 @@ impl<B: BufRead + ?Sized> BufRead for Box<B> {
214266
(**self).consume(amt)
215267
}
216268

269+
#[inline]
270+
fn has_data_left(&mut self) -> io::Result<bool> {
271+
(**self).has_data_left()
272+
}
273+
217274
#[inline]
218275
fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> io::Result<usize> {
219276
(**self).read_until(byte, buf)
220277
}
221278

279+
#[inline]
280+
fn skip_until(&mut self, byte: u8) -> io::Result<usize> {
281+
(**self).skip_until(byte)
282+
}
283+
222284
#[inline]
223285
fn read_line(&mut self, buf: &mut String) -> io::Result<usize> {
224286
(**self).read_line(buf)

0 commit comments

Comments
 (0)