@@ -104,8 +104,8 @@ impl FileDesc {
104
104
target_os = "vita" ,
105
105
target_os = "nuttx"
106
106
) ) ) ]
107
- pub fn read_vectored ( & self , mut bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
108
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
107
+ pub fn read_vectored ( & self , bufs : & mut [ IoSliceMut < ' _ > ] ) -> io:: Result < usize > {
108
+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
109
109
let ret = cvt ( unsafe {
110
110
libc:: readv (
111
111
self . as_raw_fd ( ) ,
@@ -195,12 +195,8 @@ impl FileDesc {
195
195
target_os = "netbsd" ,
196
196
target_os = "openbsd" , // OpenBSD 2.7
197
197
) ) ]
198
- pub fn read_vectored_at (
199
- & self ,
200
- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
201
- offset : u64 ,
202
- ) -> io:: Result < usize > {
203
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
198
+ pub fn read_vectored_at ( & self , bufs : & mut [ IoSliceMut < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
199
+ let bufs = io:: limit_slices_mut!( bufs, max_iov( ) ) ;
204
200
let ret = cvt ( unsafe {
205
201
libc:: preadv (
206
202
self . as_raw_fd ( ) ,
@@ -237,11 +233,7 @@ impl FileDesc {
237
233
// passing 64-bits parameters to syscalls, so we fallback to the default
238
234
// implementation if `preadv` is not available.
239
235
#[ cfg( all( target_os = "android" , target_pointer_width = "64" ) ) ]
240
- pub fn read_vectored_at (
241
- & self ,
242
- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
243
- offset : u64 ,
244
- ) -> io:: Result < usize > {
236
+ pub fn read_vectored_at ( & self , bufs : & mut [ IoSliceMut < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
245
237
super :: weak:: syscall!(
246
238
fn preadv(
247
239
fd: libc:: c_int,
@@ -251,7 +243,7 @@ impl FileDesc {
251
243
) -> isize ;
252
244
) ;
253
245
254
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
246
+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
255
247
let ret = cvt ( unsafe {
256
248
preadv (
257
249
self . as_raw_fd ( ) ,
@@ -267,11 +259,7 @@ impl FileDesc {
267
259
// FIXME(#115199): Rust currently omits weak function definitions
268
260
// and its metadata from LLVM IR.
269
261
#[ no_sanitize( cfi) ]
270
- pub fn read_vectored_at (
271
- & self ,
272
- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
273
- offset : u64 ,
274
- ) -> io:: Result < usize > {
262
+ pub fn read_vectored_at ( & self , bufs : & mut [ IoSliceMut < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
275
263
super :: weak:: weak!(
276
264
fn preadv64(
277
265
fd: libc:: c_int,
@@ -283,7 +271,7 @@ impl FileDesc {
283
271
284
272
match preadv64. get ( ) {
285
273
Some ( preadv) => {
286
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
274
+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
287
275
let ret = cvt ( unsafe {
288
276
preadv (
289
277
self . as_raw_fd ( ) ,
@@ -308,11 +296,7 @@ impl FileDesc {
308
296
// These versions may be newer than the minimum supported versions of OS's we support so we must
309
297
// use "weak" linking.
310
298
#[ cfg( target_vendor = "apple" ) ]
311
- pub fn read_vectored_at (
312
- & self ,
313
- mut bufs : & mut [ IoSliceMut < ' _ > ] ,
314
- offset : u64 ,
315
- ) -> io:: Result < usize > {
299
+ pub fn read_vectored_at ( & self , bufs : & mut [ IoSliceMut < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
316
300
super :: weak:: weak!(
317
301
fn preadv(
318
302
fd: libc:: c_int,
@@ -324,7 +308,7 @@ impl FileDesc {
324
308
325
309
match preadv. get ( ) {
326
310
Some ( preadv) => {
327
- IoSliceMut :: limit_slices ( & mut bufs, max_iov ( ) ) ;
311
+ let bufs = io :: limit_slices_mut! ( bufs, max_iov( ) ) ;
328
312
let ret = cvt ( unsafe {
329
313
preadv (
330
314
self . as_raw_fd ( ) ,
@@ -356,8 +340,8 @@ impl FileDesc {
356
340
target_os = "vita" ,
357
341
target_os = "nuttx"
358
342
) ) ) ]
359
- pub fn write_vectored ( & self , mut bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
360
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
343
+ pub fn write_vectored ( & self , bufs : & [ IoSlice < ' _ > ] ) -> io:: Result < usize > {
344
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
361
345
let ret = cvt ( unsafe {
362
346
libc:: writev (
363
347
self . as_raw_fd ( ) ,
@@ -426,8 +410,8 @@ impl FileDesc {
426
410
target_os = "netbsd" ,
427
411
target_os = "openbsd" , // OpenBSD 2.7
428
412
) ) ]
429
- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
430
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
413
+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
414
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
431
415
let ret = cvt ( unsafe {
432
416
libc:: pwritev (
433
417
self . as_raw_fd ( ) ,
@@ -464,7 +448,7 @@ impl FileDesc {
464
448
// passing 64-bits parameters to syscalls, so we fallback to the default
465
449
// implementation if `pwritev` is not available.
466
450
#[ cfg( all( target_os = "android" , target_pointer_width = "64" ) ) ]
467
- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
451
+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
468
452
super :: weak:: syscall!(
469
453
fn pwritev(
470
454
fd: libc:: c_int,
@@ -474,7 +458,7 @@ impl FileDesc {
474
458
) -> isize ;
475
459
) ;
476
460
477
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
461
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
478
462
let ret = cvt ( unsafe {
479
463
pwritev (
480
464
self . as_raw_fd ( ) ,
@@ -487,7 +471,7 @@ impl FileDesc {
487
471
}
488
472
489
473
#[ cfg( all( target_os = "android" , target_pointer_width = "32" ) ) ]
490
- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
474
+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
491
475
super :: weak:: weak!(
492
476
fn pwritev64(
493
477
fd: libc:: c_int,
@@ -499,7 +483,7 @@ impl FileDesc {
499
483
500
484
match pwritev64. get ( ) {
501
485
Some ( pwritev) => {
502
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
486
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
503
487
let ret = cvt ( unsafe {
504
488
pwritev (
505
489
self . as_raw_fd ( ) ,
@@ -524,7 +508,7 @@ impl FileDesc {
524
508
// These versions may be newer than the minimum supported versions of OS's we support so we must
525
509
// use "weak" linking.
526
510
#[ cfg( target_vendor = "apple" ) ]
527
- pub fn write_vectored_at ( & self , mut bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
511
+ pub fn write_vectored_at ( & self , bufs : & [ IoSlice < ' _ > ] , offset : u64 ) -> io:: Result < usize > {
528
512
super :: weak:: weak!(
529
513
fn pwritev(
530
514
fd: libc:: c_int,
@@ -536,7 +520,7 @@ impl FileDesc {
536
520
537
521
match pwritev. get ( ) {
538
522
Some ( pwritev) => {
539
- IoSlice :: limit_slices ( & mut bufs, max_iov ( ) ) ;
523
+ let bufs = io :: limit_slices! ( bufs, max_iov( ) ) ;
540
524
let ret = cvt ( unsafe {
541
525
pwritev (
542
526
self . as_raw_fd ( ) ,
0 commit comments