@@ -54,6 +54,20 @@ pub trait FileExt {
5454 #[ stable( feature = "file_offset" , since = "1.15.0" ) ]
5555 fn read_at ( & self , buf : & mut [ u8 ] , offset : u64 ) -> io:: Result < usize > ;
5656
57+ /// Like `read_at`, except that it reads into a slice of buffers.
58+ ///
59+ /// Data is copied to fill each buffer in order, with the final buffer
60+ /// written to possibly being only partially filled. This method must behave
61+ /// equivalently to a single call to read with concatenated buffers.
62+ #[ unstable( feature = "unix_file_vectored_at" , issue = "89517" ) ]
63+ fn read_vectored_at (
64+ & mut self ,
65+ bufs : & mut [ io:: IoSliceMut < ' _ > ] ,
66+ offset : u64 ,
67+ ) -> io:: Result < usize > {
68+ io:: default_read_vectored ( |b| self . read_at ( b, offset) , bufs)
69+ }
70+
5771 /// Reads the exact number of byte required to fill `buf` from the given offset.
5872 ///
5973 /// The offset is relative to the start of the file and thus independent
@@ -155,6 +169,16 @@ pub trait FileExt {
155169 #[ stable( feature = "file_offset" , since = "1.15.0" ) ]
156170 fn write_at ( & self , buf : & [ u8 ] , offset : u64 ) -> io:: Result < usize > ;
157171
172+ /// Like `write_at`, except that it writes from a slice of buffers.
173+ ///
174+ /// Data is copied from each buffer in order, with the final buffer read
175+ /// from possibly being only partially consumed. This method must behave as
176+ /// a call to `write_at` with the buffers concatenated would.
177+ #[ unstable( feature = "unix_file_vectored_at" , issue = "89517" ) ]
178+ fn write_vectored_at ( & mut self , bufs : & [ io:: IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
179+ io:: default_write_vectored ( |b| self . write_at ( b, offset) , bufs)
180+ }
181+
158182 /// Attempts to write an entire buffer starting from a given offset.
159183 ///
160184 /// The offset is relative to the start of the file and thus independent
@@ -218,9 +242,19 @@ impl FileExt for fs::File {
218242 fn read_at ( & self , buf : & mut [ u8 ] , offset : u64 ) -> io:: Result < usize > {
219243 self . as_inner ( ) . read_at ( buf, offset)
220244 }
245+ fn read_vectored_at (
246+ & mut self ,
247+ bufs : & mut [ io:: IoSliceMut < ' _ > ] ,
248+ offset : u64 ,
249+ ) -> io:: Result < usize > {
250+ self . as_inner ( ) . read_vectored_at ( bufs, offset)
251+ }
221252 fn write_at ( & self , buf : & [ u8 ] , offset : u64 ) -> io:: Result < usize > {
222253 self . as_inner ( ) . write_at ( buf, offset)
223254 }
255+ fn write_vectored_at ( & mut self , bufs : & [ io:: IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
256+ self . as_inner ( ) . write_vectored_at ( bufs, offset)
257+ }
224258}
225259
226260/// Unix-specific extensions to [`fs::Permissions`].
0 commit comments