about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorThe8472 <git@infinite-source.de>2020-09-06 22:50:35 +0200
committerThe8472 <git@infinite-source.de>2020-11-13 19:45:38 +0100
commit0624730d9e9e2b6de974b6f4edd1ea48ab5f240c (patch)
treee0135b64e2cede2beec0eb5fd69e2c572c45e41a /library/std/src
parentcd3bddc044728e040d6a22c684f1b9f711566772 (diff)
downloadrust-0624730d9e9e2b6de974b6f4edd1ea48ab5f240c.tar.gz
rust-0624730d9e9e2b6de974b6f4edd1ea48ab5f240c.zip
add forwarding specializations for &mut variants
`impl Write for &mut T where T: Write`, thus the same should
apply to the specialization traits
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/io/copy.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/library/std/src/io/copy.rs b/library/std/src/io/copy.rs
index f54a9b8b764..e8cbe6a7e71 100644
--- a/library/std/src/io/copy.rs
+++ b/library/std/src/io/copy.rs
@@ -235,6 +235,27 @@ mod kernel_copy {
         fn properties(&self) -> CopyParams;
     }
 
+    impl<T> CopyRead for &mut T where T: CopyRead {
+        fn drain_to<W: Write>(&mut self, writer: &mut W, limit: u64) -> Result<u64> {
+            (**self).drain_to(writer, limit)
+        }
+
+        fn min_limit(&self) -> u64 {
+            (**self).min_limit()
+        }
+
+        fn properties(&self) -> CopyParams {
+            (**self).properties()
+        }
+    }
+
+    impl<T> CopyWrite for &mut T where T: CopyWrite {
+        fn properties(&self) -> CopyParams {
+            (**self).properties()
+        }
+    }
+
+
     impl CopyRead for File {
         fn properties(&self) -> CopyParams {
             CopyParams(fd_to_meta(self), Some(self.as_raw_fd()))