@@ -110,8 +110,8 @@ impl FileDesc {
110110 target_os = "vita" ,
111111 target_os = "nuttx"
112112 ) ) ) ]
113- pub fn read_vectored ( & self , mut bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
114- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
113+ pub fn read_vectored ( & self , bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
114+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
115115 let ret = cvt ( unsafe {
116116 libc:: readv (
117117 self . as_raw_fd ( ) ,
@@ -201,12 +201,8 @@ impl FileDesc {
201201 target_os = "netbsd" ,
202202 target_os = "openbsd" , // OpenBSD 2.7
203203 ) ) ]
204- pub fn read_vectored_at (
205- & self ,
206- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
207- offset : u64 ,
208- ) -> io:: Result < usize > {
209- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
204+ pub fn read_vectored_at ( & self , bufs : & mut [ IoSliceMut < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
205+ let bufs = io:: limit_slices_mut!( bufs, max_iov( ) ) ;
210206 let ret = cvt ( unsafe {
211207 libc:: preadv (
212208 self . as_raw_fd ( ) ,
@@ -243,11 +239,7 @@ impl FileDesc {
243239 // passing 64-bits parameters to syscalls, so we fallback to the default
244240 // implementation if `preadv` is not available.
245241 #[ cfg( all( target_os = "android" , target_pointer_width = "64" ) ) ]
246- pub fn read_vectored_at (
247- & self ,
248- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
249- offset : u64 ,
250- ) -> io:: Result < usize > {
242+ pub fn read_vectored_at ( & self , bufs : & mut [ IoSliceMut < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
251243 syscall ! (
252244 fn preadv(
253245 fd: libc:: c_int,
@@ -257,7 +249,7 @@ impl FileDesc {
257249 ) -> isize ;
258250 ) ;
259251
260- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
252+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
261253 let ret = cvt ( unsafe {
262254 preadv (
263255 self . as_raw_fd ( ) ,
@@ -272,7 +264,7 @@ impl FileDesc {
272264 #[ cfg( all( target_os = "android" , target_pointer_width = "32" ) ) ]
273265 pub fn read_vectored_at (
274266 & self ,
275- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
267+ bufs : & mut [ IoSliceMut < ' _ > ] ,
276268 offset : u64 ,
277269 ) -> io:: Result < usize > {
278270 weak ! (
@@ -286,7 +278,7 @@ impl FileDesc {
286278
287279 match preadv64. get ( ) {
288280 Some ( preadv) => {
289- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
281+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
290282 let ret = cvt ( unsafe {
291283 preadv (
292284 self . as_raw_fd ( ) ,
@@ -311,11 +303,7 @@ impl FileDesc {
311303 // These versions may be newer than the minimum supported versions of OS's we support so we must
312304 // use "weak" linking.
313305 #[ cfg( target_vendor = "apple" ) ]
314- pub fn read_vectored_at (
315- & self ,
316- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
317- offset : u64 ,
318- ) -> io:: Result < usize > {
306+ pub fn read_vectored_at ( & self , bufs : & mut [ IoSliceMut < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
319307 weak ! (
320308 fn preadv(
321309 fd: libc:: c_int,
@@ -327,7 +315,7 @@ impl FileDesc {
327315
328316 match preadv. get ( ) {
329317 Some ( preadv) => {
330- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
318+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
331319 let ret = cvt ( unsafe {
332320 preadv (
333321 self . as_raw_fd ( ) ,
@@ -359,8 +347,8 @@ impl FileDesc {
359347 target_os = "vita" ,
360348 target_os = "nuttx"
361349 ) ) ) ]
362- pub fn write_vectored ( & self , mut bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
363- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
350+ pub fn write_vectored ( & self , bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
351+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
364352 let ret = cvt ( unsafe {
365353 libc:: writev (
366354 self . as_raw_fd ( ) ,
@@ -429,8 +417,8 @@ impl FileDesc {
429417 target_os = "netbsd" ,
430418 target_os = "openbsd" , // OpenBSD 2.7
431419 ) ) ]
432- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
433- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
420+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
421+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
434422 let ret = cvt ( unsafe {
435423 libc:: pwritev (
436424 self . as_raw_fd ( ) ,
@@ -467,7 +455,7 @@ impl FileDesc {
467455 // passing 64-bits parameters to syscalls, so we fallback to the default
468456 // implementation if `pwritev` is not available.
469457 #[ cfg( all( target_os = "android" , target_pointer_width = "64" ) ) ]
470- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
458+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
471459 syscall ! (
472460 fn pwritev(
473461 fd: libc:: c_int,
@@ -477,7 +465,7 @@ impl FileDesc {
477465 ) -> isize ;
478466 ) ;
479467
480- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
468+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
481469 let ret = cvt ( unsafe {
482470 pwritev (
483471 self . as_raw_fd ( ) ,
@@ -490,7 +478,7 @@ impl FileDesc {
490478 }
491479
492480 #[ cfg( all( target_os = "android" , target_pointer_width = "32" ) ) ]
493- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
481+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
494482 weak ! (
495483 fn pwritev64(
496484 fd: libc:: c_int,
@@ -502,7 +490,7 @@ impl FileDesc {
502490
503491 match pwritev64. get ( ) {
504492 Some ( pwritev) => {
505- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
493+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
506494 let ret = cvt ( unsafe {
507495 pwritev (
508496 self . as_raw_fd ( ) ,
@@ -527,7 +515,7 @@ impl FileDesc {
527515 // These versions may be newer than the minimum supported versions of OS's we support so we must
528516 // use "weak" linking.
529517 #[ cfg( target_vendor = "apple" ) ]
530- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
518+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
531519 weak ! (
532520 fn pwritev(
533521 fd: libc:: c_int,
@@ -539,7 +527,7 @@ impl FileDesc {
539527
540528 match pwritev. get ( ) {
541529 Some ( pwritev) => {
542- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
530+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
543531 let ret = cvt ( unsafe {
544532 pwritev (
545533 self . as_raw_fd ( ) ,
0 commit comments