@@ -110,8 +110,8 @@ impl FileDesc {
110
110
target_os = "vita" ,
111
111
target_os = "nuttx"
112
112
) ) ) ]
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( ) ) ;
115
115
let ret = cvt ( unsafe {
116
116
libc:: readv (
117
117
self . as_raw_fd ( ) ,
@@ -201,12 +201,8 @@ impl FileDesc {
201
201
target_os = "netbsd" ,
202
202
target_os = "openbsd" , // OpenBSD 2.7
203
203
) ) ]
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( ) ) ;
210
206
let ret = cvt ( unsafe {
211
207
libc:: preadv (
212
208
self . as_raw_fd ( ) ,
@@ -243,11 +239,7 @@ impl FileDesc {
243
239
// passing 64-bits parameters to syscalls, so we fallback to the default
244
240
// implementation if `preadv` is not available.
245
241
#[ 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 > {
251
243
syscall ! (
252
244
fn preadv(
253
245
fd: libc:: c_int,
@@ -257,7 +249,7 @@ impl FileDesc {
257
249
) -> isize ;
258
250
) ;
259
251
260
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
252
+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
261
253
let ret = cvt ( unsafe {
262
254
preadv (
263
255
self . as_raw_fd ( ) ,
@@ -272,7 +264,7 @@ impl FileDesc {
272
264
#[ cfg( all( target_os = "android" , target_pointer_width = "32" ) ) ]
273
265
pub fn read_vectored_at (
274
266
& self ,
275
- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
267
+ bufs : & mut [ IoSliceMut < ' _ > ] ,
276
268
offset : u64 ,
277
269
) -> io:: Result < usize > {
278
270
weak ! (
@@ -286,7 +278,7 @@ impl FileDesc {
286
278
287
279
match preadv64. get ( ) {
288
280
Some ( preadv) => {
289
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
281
+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
290
282
let ret = cvt ( unsafe {
291
283
preadv (
292
284
self . as_raw_fd ( ) ,
@@ -311,11 +303,7 @@ impl FileDesc {
311
303
// These versions may be newer than the minimum supported versions of OS's we support so we must
312
304
// use "weak" linking.
313
305
#[ 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 > {
319
307
weak ! (
320
308
fn preadv(
321
309
fd: libc:: c_int,
@@ -327,7 +315,7 @@ impl FileDesc {
327
315
328
316
match preadv. get ( ) {
329
317
Some ( preadv) => {
330
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
318
+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
331
319
let ret = cvt ( unsafe {
332
320
preadv (
333
321
self . as_raw_fd ( ) ,
@@ -359,8 +347,8 @@ impl FileDesc {
359
347
target_os = "vita" ,
360
348
target_os = "nuttx"
361
349
) ) ) ]
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( ) ) ;
364
352
let ret = cvt ( unsafe {
365
353
libc:: writev (
366
354
self . as_raw_fd ( ) ,
@@ -429,8 +417,8 @@ impl FileDesc {
429
417
target_os = "netbsd" ,
430
418
target_os = "openbsd" , // OpenBSD 2.7
431
419
) ) ]
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( ) ) ;
434
422
let ret = cvt ( unsafe {
435
423
libc:: pwritev (
436
424
self . as_raw_fd ( ) ,
@@ -467,7 +455,7 @@ impl FileDesc {
467
455
// passing 64-bits parameters to syscalls, so we fallback to the default
468
456
// implementation if `pwritev` is not available.
469
457
#[ 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 > {
471
459
syscall ! (
472
460
fn pwritev(
473
461
fd: libc:: c_int,
@@ -477,7 +465,7 @@ impl FileDesc {
477
465
) -> isize ;
478
466
) ;
479
467
480
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
468
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
481
469
let ret = cvt ( unsafe {
482
470
pwritev (
483
471
self . as_raw_fd ( ) ,
@@ -490,7 +478,7 @@ impl FileDesc {
490
478
}
491
479
492
480
#[ 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 > {
494
482
weak ! (
495
483
fn pwritev64(
496
484
fd: libc:: c_int,
@@ -502,7 +490,7 @@ impl FileDesc {
502
490
503
491
match pwritev64. get ( ) {
504
492
Some ( pwritev) => {
505
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
493
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
506
494
let ret = cvt ( unsafe {
507
495
pwritev (
508
496
self . as_raw_fd ( ) ,
@@ -527,7 +515,7 @@ impl FileDesc {
527
515
// These versions may be newer than the minimum supported versions of OS's we support so we must
528
516
// use "weak" linking.
529
517
#[ 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 > {
531
519
weak ! (
532
520
fn pwritev(
533
521
fd: libc:: c_int,
@@ -539,7 +527,7 @@ impl FileDesc {
539
527
540
528
match pwritev. get ( ) {
541
529
Some ( pwritev) => {
542
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
530
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
543
531
let ret = cvt ( unsafe {
544
532
pwritev (
545
533
self . as_raw_fd ( ) ,
0 commit comments