]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/io/copy.rs
add forwarding specializations for &mut variants
[rust.git] / library / std / src / io / copy.rs
index f54a9b8b7649b5338ab1944f573ffbd4746c4d7e..e8cbe6a7e715a084201b26bdc9b6e5637e3f5a86 100644 (file)
@@ -235,6 +235,27 @@ trait CopyWrite: Write {
         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()))