From 1e63f08c85d7bc2fb9cf2fad21d6d17359b0be15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20du=20Garreau?= Date: Thu, 2 Mar 2023 11:50:27 +0100 Subject: [PATCH] Take shared references as parameter --- library/std/src/os/unix/fs.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs index edd77c824ad..2915dc56bfc 100644 --- a/library/std/src/os/unix/fs.rs +++ b/library/std/src/os/unix/fs.rs @@ -60,11 +60,7 @@ pub trait FileExt { /// written to possibly being only partially filled. This method must behave /// equivalently to a single call to read with concatenated buffers. #[unstable(feature = "unix_file_vectored_at", issue = "89517")] - fn read_vectored_at( - &mut self, - bufs: &mut [io::IoSliceMut<'_>], - offset: u64, - ) -> io::Result { + fn read_vectored_at(&self, bufs: &mut [io::IoSliceMut<'_>], offset: u64) -> io::Result { io::default_read_vectored(|b| self.read_at(b, offset), bufs) } @@ -175,7 +171,7 @@ fn read_exact_at(&self, mut buf: &mut [u8], mut offset: u64) -> io::Result<()> { /// from possibly being only partially consumed. This method must behave as /// a call to `write_at` with the buffers concatenated would. #[unstable(feature = "unix_file_vectored_at", issue = "89517")] - fn write_vectored_at(&mut self, bufs: &[io::IoSlice<'_>], offset: u64) -> io::Result { + fn write_vectored_at(&self, bufs: &[io::IoSlice<'_>], offset: u64) -> io::Result { io::default_write_vectored(|b| self.write_at(b, offset), bufs) } @@ -242,17 +238,13 @@ impl FileExt for fs::File { fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result { self.as_inner().read_at(buf, offset) } - fn read_vectored_at( - &mut self, - bufs: &mut [io::IoSliceMut<'_>], - offset: u64, - ) -> io::Result { + fn read_vectored_at(&self, bufs: &mut [io::IoSliceMut<'_>], offset: u64) -> io::Result { self.as_inner().read_vectored_at(bufs, offset) } fn write_at(&self, buf: &[u8], offset: u64) -> io::Result { self.as_inner().write_at(buf, offset) } - fn write_vectored_at(&mut self, bufs: &[io::IoSlice<'_>], offset: u64) -> io::Result { + fn write_vectored_at(&self, bufs: &[io::IoSlice<'_>], offset: u64) -> io::Result { self.as_inner().write_vectored_at(bufs, offset) } }