X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=library%2Fstd%2Fsrc%2Fio%2Fcopy.rs;h=e8cbe6a7e715a084201b26bdc9b6e5637e3f5a86;hb=0624730d9e9e2b6de974b6f4edd1ea48ab5f240c;hp=f54a9b8b7649b5338ab1944f573ffbd4746c4d7e;hpb=cd3bddc044728e040d6a22c684f1b9f711566772;p=rust.git 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 @@ trait CopyWrite: Write { fn properties(&self) -> CopyParams; } + impl CopyRead for &mut T where T: CopyRead { + fn drain_to(&mut self, writer: &mut W, limit: u64) -> Result { + (**self).drain_to(writer, limit) + } + + fn min_limit(&self) -> u64 { + (**self).min_limit() + } + + fn properties(&self) -> CopyParams { + (**self).properties() + } + } + + impl 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()))