Skip to content

Commit 0624730

Browse files
committed
add forwarding specializations for &mut variants
`impl Write for &mut T where T: Write`, thus the same should apply to the specialization traits
1 parent cd3bddc commit 0624730

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

library/std/src/io/copy.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,27 @@ mod kernel_copy {
235235
fn properties(&self) -> CopyParams;
236236
}
237237

238+
impl<T> CopyRead for &mut T where T: CopyRead {
239+
fn drain_to<W: Write>(&mut self, writer: &mut W, limit: u64) -> Result<u64> {
240+
(**self).drain_to(writer, limit)
241+
}
242+
243+
fn min_limit(&self) -> u64 {
244+
(**self).min_limit()
245+
}
246+
247+
fn properties(&self) -> CopyParams {
248+
(**self).properties()
249+
}
250+
}
251+
252+
impl<T> CopyWrite for &mut T where T: CopyWrite {
253+
fn properties(&self) -> CopyParams {
254+
(**self).properties()
255+
}
256+
}
257+
258+
238259
impl CopyRead for File {
239260
fn properties(&self) -> CopyParams {
240261
CopyParams(fd_to_meta(self), Some(self.as_raw_fd()))

0 commit comments

Comments
 (0)