@@ -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 ( ) ,
@@ -270,11 +262,7 @@ impl FileDesc {
270
262
}
271
263
272
264
#[ 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 > {
278
266
weak ! (
279
267
fn preadv64(
280
268
fd: libc:: c_int,
@@ -286,7 +274,7 @@ impl FileDesc {
286
274
287
275
match preadv64. get ( ) {
288
276
Some ( preadv) => {
289
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
277
+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
290
278
let ret = cvt ( unsafe {
291
279
preadv (
292
280
self . as_raw_fd ( ) ,
@@ -311,11 +299,7 @@ impl FileDesc {
311
299
// These versions may be newer than the minimum supported versions of OS's we support so we must
312
300
// use "weak" linking.
313
301
#[ 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 > {
319
303
weak ! (
320
304
fn preadv(
321
305
fd: libc:: c_int,
@@ -327,7 +311,7 @@ impl FileDesc {
327
311
328
312
match preadv. get ( ) {
329
313
Some ( preadv) => {
330
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
314
+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
331
315
let ret = cvt ( unsafe {
332
316
preadv (
333
317
self . as_raw_fd ( ) ,
@@ -359,8 +343,8 @@ impl FileDesc {
359
343
target_os = "vita" ,
360
344
target_os = "nuttx"
361
345
) ) ) ]
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( ) ) ;
364
348
let ret = cvt ( unsafe {
365
349
libc:: writev (
366
350
self . as_raw_fd ( ) ,
@@ -429,8 +413,8 @@ impl FileDesc {
429
413
target_os = "netbsd" ,
430
414
target_os = "openbsd" , // OpenBSD 2.7
431
415
) ) ]
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( ) ) ;
434
418
let ret = cvt ( unsafe {
435
419
libc:: pwritev (
436
420
self . as_raw_fd ( ) ,
@@ -467,7 +451,7 @@ impl FileDesc {
467
451
// passing 64-bits parameters to syscalls, so we fallback to the default
468
452
// implementation if `pwritev` is not available.
469
453
#[ 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 > {
471
455
syscall ! (
472
456
fn pwritev(
473
457
fd: libc:: c_int,
@@ -477,7 +461,7 @@ impl FileDesc {
477
461
) -> isize ;
478
462
) ;
479
463
480
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
464
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
481
465
let ret = cvt ( unsafe {
482
466
pwritev (
483
467
self . as_raw_fd ( ) ,
@@ -490,7 +474,7 @@ impl FileDesc {
490
474
}
491
475
492
476
#[ 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 > {
494
478
weak ! (
495
479
fn pwritev64(
496
480
fd: libc:: c_int,
@@ -502,7 +486,7 @@ impl FileDesc {
502
486
503
487
match pwritev64. get ( ) {
504
488
Some ( pwritev) => {
505
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
489
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
506
490
let ret = cvt ( unsafe {
507
491
pwritev (
508
492
self . as_raw_fd ( ) ,
@@ -527,7 +511,7 @@ impl FileDesc {
527
511
// These versions may be newer than the minimum supported versions of OS's we support so we must
528
512
// use "weak" linking.
529
513
#[ 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 > {
531
515
weak ! (
532
516
fn pwritev(
533
517
fd: libc:: c_int,
@@ -539,7 +523,7 @@ impl FileDesc {
539
523
540
524
match pwritev. get ( ) {
541
525
Some ( pwritev) => {
542
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
526
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
543
527
let ret = cvt ( unsafe {
544
528
pwritev (
545
529
self . as_raw_fd ( ) ,
0 commit comments