@@ -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 ( ) ,
@@ -270,11 +262,7 @@ impl FileDesc {
270262 }
271263
272264 #[ cfg( all( target_os = "android" , target_pointer_width = "32" ) ) ]
273- pub fn read_vectored_at (
274- & self ,
275- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
276- offset : u64 ,
277- ) -> io:: Result < usize > {
265+ pub fn read_vectored_at ( & self , bufs : & mut [ IoSliceMut < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
278266 weak ! (
279267 fn preadv64(
280268 fd: libc:: c_int,
@@ -286,7 +274,7 @@ impl FileDesc {
286274
287275 match preadv64. get ( ) {
288276 Some ( preadv) => {
289- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
277+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
290278 let ret = cvt ( unsafe {
291279 preadv (
292280 self . as_raw_fd ( ) ,
@@ -311,11 +299,7 @@ impl FileDesc {
311299 // These versions may be newer than the minimum supported versions of OS's we support so we must
312300 // use "weak" linking.
313301 #[ cfg( target_vendor = "apple" ) ]
314- pub fn read_vectored_at (
315- & self ,
316- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
317- offset : u64 ,
318- ) -> io:: Result < usize > {
302+ pub fn read_vectored_at ( & self , bufs : & mut [ IoSliceMut < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
319303 weak ! (
320304 fn preadv(
321305 fd: libc:: c_int,
@@ -327,7 +311,7 @@ impl FileDesc {
327311
328312 match preadv. get ( ) {
329313 Some ( preadv) => {
330- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
314+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
331315 let ret = cvt ( unsafe {
332316 preadv (
333317 self . as_raw_fd ( ) ,
@@ -359,8 +343,8 @@ impl FileDesc {
359343 target_os = "vita" ,
360344 target_os = "nuttx"
361345 ) ) ) ]
362- pub fn write_vectored ( & self , mut bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
363- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
346+ pub fn write_vectored ( & self , bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
347+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
364348 let ret = cvt ( unsafe {
365349 libc:: writev (
366350 self . as_raw_fd ( ) ,
@@ -429,8 +413,8 @@ impl FileDesc {
429413 target_os = "netbsd" ,
430414 target_os = "openbsd" , // OpenBSD 2.7
431415 ) ) ]
432- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
433- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
416+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
417+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
434418 let ret = cvt ( unsafe {
435419 libc:: pwritev (
436420 self . as_raw_fd ( ) ,
@@ -467,7 +451,7 @@ impl FileDesc {
467451 // passing 64-bits parameters to syscalls, so we fallback to the default
468452 // implementation if `pwritev` is not available.
469453 #[ cfg( all( target_os = "android" , target_pointer_width = "64" ) ) ]
470- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
454+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
471455 syscall ! (
472456 fn pwritev(
473457 fd: libc:: c_int,
@@ -477,7 +461,7 @@ impl FileDesc {
477461 ) -> isize ;
478462 ) ;
479463
480- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
464+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
481465 let ret = cvt ( unsafe {
482466 pwritev (
483467 self . as_raw_fd ( ) ,
@@ -490,7 +474,7 @@ impl FileDesc {
490474 }
491475
492476 #[ cfg( all( target_os = "android" , target_pointer_width = "32" ) ) ]
493- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
477+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
494478 weak ! (
495479 fn pwritev64(
496480 fd: libc:: c_int,
@@ -502,7 +486,7 @@ impl FileDesc {
502486
503487 match pwritev64. get ( ) {
504488 Some ( pwritev) => {
505- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
489+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
506490 let ret = cvt ( unsafe {
507491 pwritev (
508492 self . as_raw_fd ( ) ,
@@ -527,7 +511,7 @@ impl FileDesc {
527511 // These versions may be newer than the minimum supported versions of OS's we support so we must
528512 // use "weak" linking.
529513 #[ cfg( target_vendor = "apple" ) ]
530- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
514+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
531515 weak ! (
532516 fn pwritev(
533517 fd: libc:: c_int,
@@ -539,7 +523,7 @@ impl FileDesc {
539523
540524 match pwritev. get ( ) {
541525 Some ( pwritev) => {
542- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
526+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
543527 let ret = cvt ( unsafe {
544528 pwritev (
545529 self . as_raw_fd ( ) ,
0 commit comments