@@ -20,14 +20,13 @@ mod if_std {
2020 use std:: pin:: Pin ;
2121 use std:: ptr;
2222
23- // Re-export IoVec for convenience
24- pub use iovec:: IoVec ;
25-
2623 // Re-export some types from `std::io` so that users don't have to deal
2724 // with conflicts when `use`ing `futures::io` and `std::io`.
2825 pub use self :: StdIo :: Error as Error ;
2926 pub use self :: StdIo :: ErrorKind as ErrorKind ;
3027 pub use self :: StdIo :: Result as Result ;
28+ pub use self :: StdIo :: IoSlice as IoSlice ;
29+ pub use self :: StdIo :: IoSliceMut as IoSliceMut ;
3130 pub use self :: StdIo :: SeekFrom as SeekFrom ;
3231
3332 /// A type used to conditionally initialize buffers passed to `AsyncRead`
@@ -134,7 +133,7 @@ mod if_std {
134133 /// `Interrupted`. Implementations must convert `WouldBlock` into
135134 /// `Poll::Pending` and either internally retry or convert
136135 /// `Interrupted` into another error kind.
137- fn poll_vectored_read ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ & mut IoVec ] )
136+ fn poll_read_vectored ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ IoSliceMut < ' _ > ] )
138137 -> Poll < Result < usize > >
139138 {
140139 if let Some ( ref mut first_iovec) = vec. get_mut ( 0 ) {
@@ -195,13 +194,13 @@ mod if_std {
195194 /// `Interrupted`. Implementations must convert `WouldBlock` into
196195 /// `Poll::Pending` and either internally retry or convert
197196 /// `Interrupted` into another error kind.
198- fn poll_vectored_write ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & [ & IoVec ] )
197+ fn poll_write_vectored ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , bufs : & [ IoSlice < ' _ > ] )
199198 -> Poll < Result < usize > >
200199 {
201- if let Some ( ref first_iovec) = vec . get ( 0 ) {
200+ if let Some ( ref first_iovec) = bufs . get ( 0 ) {
202201 self . poll_write ( cx, & * first_iovec)
203202 } else {
204- // `vec ` is empty.
203+ // `bufs ` is empty.
205204 Poll :: Ready ( Ok ( 0 ) )
206205 }
207206 }
@@ -335,10 +334,10 @@ mod if_std {
335334 Pin :: new( & mut * * self ) . poll_read( cx, buf)
336335 }
337336
338- fn poll_vectored_read ( mut self : Pin <& mut Self >, cx: & mut Context <' _>, vec: & mut [ & mut IoVec ] )
337+ fn poll_read_vectored ( mut self : Pin <& mut Self >, cx: & mut Context <' _>, vec: & mut [ IoSliceMut < ' _> ] )
339338 -> Poll <Result <usize >>
340339 {
341- Pin :: new( & mut * * self ) . poll_vectored_read ( cx, vec)
340+ Pin :: new( & mut * * self ) . poll_read_vectored ( cx, vec)
342341 }
343342 }
344343 }
@@ -366,10 +365,10 @@ mod if_std {
366365 Pin :: get_mut ( self ) . as_mut ( ) . poll_read ( cx, buf)
367366 }
368367
369- fn poll_vectored_read ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ & mut IoVec ] )
368+ fn poll_read_vectored ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ IoSliceMut < ' _ > ] )
370369 -> Poll < Result < usize > >
371370 {
372- Pin :: get_mut ( self ) . as_mut ( ) . poll_vectored_read ( cx, vec)
371+ Pin :: get_mut ( self ) . as_mut ( ) . poll_read_vectored ( cx, vec)
373372 }
374373 }
375374
@@ -386,6 +385,12 @@ mod if_std {
386385 {
387386 Poll :: Ready ( StdIo :: Read :: read( & mut * self , buf) )
388387 }
388+
389+ fn poll_read_vectored( mut self : Pin <& mut Self >, _: & mut Context <' _>, vec: & mut [ IoSliceMut <' _>] )
390+ -> Poll <Result <usize >>
391+ {
392+ Poll :: Ready ( StdIo :: Read :: read_vectored( & mut * self , vec) )
393+ }
389394 }
390395 }
391396
@@ -413,10 +418,10 @@ mod if_std {
413418 Pin :: new( & mut * * self ) . poll_write( cx, buf)
414419 }
415420
416- fn poll_vectored_write ( mut self : Pin <& mut Self >, cx: & mut Context <' _>, vec : & [ & IoVec ] )
421+ fn poll_write_vectored ( mut self : Pin <& mut Self >, cx: & mut Context <' _>, bufs : & [ IoSlice < ' _> ] )
417422 -> Poll <Result <usize >>
418423 {
419- Pin :: new( & mut * * self ) . poll_vectored_write ( cx, vec )
424+ Pin :: new( & mut * * self ) . poll_write_vectored ( cx, bufs )
420425 }
421426
422427 fn poll_flush( mut self : Pin <& mut Self >, cx: & mut Context <' _>) -> Poll <Result <( ) >> {
@@ -448,10 +453,10 @@ mod if_std {
448453 Pin :: get_mut ( self ) . as_mut ( ) . poll_write ( cx, buf)
449454 }
450455
451- fn poll_vectored_write ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & [ & IoVec ] )
456+ fn poll_write_vectored ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , bufs : & [ IoSlice < ' _ > ] )
452457 -> Poll < Result < usize > >
453458 {
454- Pin :: get_mut ( self ) . as_mut ( ) . poll_vectored_write ( cx, vec )
459+ Pin :: get_mut ( self ) . as_mut ( ) . poll_write_vectored ( cx, bufs )
455460 }
456461
457462 fn poll_flush ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) > > {
@@ -471,6 +476,12 @@ mod if_std {
471476 Poll :: Ready ( StdIo :: Write :: write( & mut * self , buf) )
472477 }
473478
479+ fn poll_write_vectored( mut self : Pin <& mut Self >, _: & mut Context <' _>, bufs: & [ IoSlice <' _>] )
480+ -> Poll <Result <usize >>
481+ {
482+ Poll :: Ready ( StdIo :: Write :: write_vectored( & mut * self , bufs) )
483+ }
484+
474485 fn poll_flush( mut self : Pin <& mut Self >, _: & mut Context <' _>) -> Poll <Result <( ) >> {
475486 Poll :: Ready ( StdIo :: Write :: flush( & mut * self ) )
476487 }
@@ -499,6 +510,12 @@ mod if_std {
499510 Poll :: Ready ( result)
500511 }
501512
513+ fn poll_write_vectored ( self : Pin < & mut Self > , _: & mut Context < ' _ > , bufs : & [ IoSlice < ' _ > ] )
514+ -> Poll < Result < usize > >
515+ {
516+ Poll :: Ready ( StdIo :: Write :: write_vectored ( & mut self . get_mut ( ) . get_mut ( ) . as_mut ( ) , bufs) )
517+ }
518+
502519 fn poll_flush ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) > > {
503520 Poll :: Ready ( StdIo :: Write :: flush ( & mut self . get_mut ( ) . get_mut ( ) . as_mut ( ) ) )
504521 }
0 commit comments