@@ -20,14 +20,12 @@ 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-
26- // Re-export io::Error so that users don't have to deal
23+ // Re-export some `std::io` items 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 :: { IoVec as IoVec , IoVecMut as IoVecMut } ;
3129
3230 /// A type used to conditionally initialize buffers passed to `AsyncRead`
3331 /// methods, modeled after `std`.
@@ -133,7 +131,7 @@ mod if_std {
133131 /// `Interrupted`. Implementations must convert `WouldBlock` into
134132 /// `Poll::Pending` and either internally retry or convert
135133 /// `Interrupted` into another error kind.
136- fn poll_vectored_read ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ & mut IoVec ] )
134+ fn poll_read_vectored ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ IoVecMut < ' _ > ] )
137135 -> Poll < Result < usize > >
138136 {
139137 if let Some ( ref mut first_iovec) = vec. get_mut ( 0 ) {
@@ -194,7 +192,7 @@ mod if_std {
194192 /// `Interrupted`. Implementations must convert `WouldBlock` into
195193 /// `Poll::Pending` and either internally retry or convert
196194 /// `Interrupted` into another error kind.
197- fn poll_vectored_write ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & [ & IoVec ] )
195+ fn poll_write_vectored ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & [ IoVec < ' _ > ] )
198196 -> Poll < Result < usize > >
199197 {
200198 if let Some ( ref first_iovec) = vec. get ( 0 ) {
@@ -253,10 +251,10 @@ mod if_std {
253251 Pin :: new( & mut * * self ) . poll_read( cx, buf)
254252 }
255253
256- fn poll_vectored_read ( mut self : Pin <& mut Self >, cx: & mut Context <' _>, vec: & mut [ & mut IoVec ] )
254+ fn poll_read_vectored ( mut self : Pin <& mut Self >, cx: & mut Context <' _>, vec: & mut [ IoVecMut < ' _> ] )
257255 -> Poll <Result <usize >>
258256 {
259- Pin :: new( & mut * * self ) . poll_vectored_read ( cx, vec)
257+ Pin :: new( & mut * * self ) . poll_read_vectored ( cx, vec)
260258 }
261259 }
262260 }
@@ -284,10 +282,10 @@ mod if_std {
284282 Pin :: get_mut ( self ) . as_mut ( ) . poll_read ( cx, buf)
285283 }
286284
287- fn poll_vectored_read ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ & mut IoVec ] )
285+ fn poll_read_vectored ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ IoVecMut < ' _ > ] )
288286 -> Poll < Result < usize > >
289287 {
290- Pin :: get_mut ( self ) . as_mut ( ) . poll_vectored_read ( cx, vec)
288+ Pin :: get_mut ( self ) . as_mut ( ) . poll_read_vectored ( cx, vec)
291289 }
292290 }
293291
@@ -304,6 +302,12 @@ mod if_std {
304302 {
305303 Poll :: Ready ( StdIo :: Read :: read( & mut * self , buf) )
306304 }
305+
306+ fn poll_read_vectored( mut self : Pin <& mut Self >, _: & mut Context <' _>, vec: & mut [ IoVecMut <' _>] )
307+ -> Poll <Result <usize >>
308+ {
309+ Poll :: Ready ( StdIo :: Read :: read_vectored( & mut * self , vec) )
310+ }
307311 }
308312 }
309313
@@ -327,10 +331,10 @@ mod if_std {
327331 Pin :: new( & mut * * self ) . poll_write( cx, buf)
328332 }
329333
330- fn poll_vectored_write ( mut self : Pin <& mut Self >, cx: & mut Context <' _>, vec: & [ & IoVec ] )
334+ fn poll_write_vectored ( mut self : Pin <& mut Self >, cx: & mut Context <' _>, vec: & [ IoVec < ' _> ] )
331335 -> Poll <Result <usize >>
332336 {
333- Pin :: new( & mut * * self ) . poll_vectored_write ( cx, vec)
337+ Pin :: new( & mut * * self ) . poll_write_vectored ( cx, vec)
334338 }
335339
336340 fn poll_flush( mut self : Pin <& mut Self >, cx: & mut Context <' _>) -> Poll <Result <( ) >> {
@@ -362,10 +366,10 @@ mod if_std {
362366 Pin :: get_mut ( self ) . as_mut ( ) . poll_write ( cx, buf)
363367 }
364368
365- fn poll_vectored_write ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & [ & IoVec ] )
369+ fn poll_write_vectored ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & [ IoVec < ' _ > ] )
366370 -> Poll < Result < usize > >
367371 {
368- Pin :: get_mut ( self ) . as_mut ( ) . poll_vectored_write ( cx, vec)
372+ Pin :: get_mut ( self ) . as_mut ( ) . poll_write_vectored ( cx, vec)
369373 }
370374
371375 fn poll_flush ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Result < ( ) > > {
@@ -385,6 +389,12 @@ mod if_std {
385389 Poll :: Ready ( StdIo :: Write :: write( & mut * self , buf) )
386390 }
387391
392+ fn poll_write_vectored( mut self : Pin <& mut Self >, _: & mut Context <' _>, vec: & [ IoVec <' _>] )
393+ -> Poll <Result <usize >>
394+ {
395+ Poll :: Ready ( StdIo :: Write :: write_vectored( & mut * self , vec) )
396+ }
397+
388398 fn poll_flush( mut self : Pin <& mut Self >, _: & mut Context <' _>) -> Poll <Result <( ) >> {
389399 Poll :: Ready ( StdIo :: Write :: flush( & mut * self ) )
390400 }
@@ -413,6 +423,12 @@ mod if_std {
413423 Poll :: Ready ( result)
414424 }
415425
426+ fn poll_write_vectored ( self : Pin < & mut Self > , _: & mut Context < ' _ > , vec : & [ IoVec < ' _ > ] )
427+ -> Poll < Result < usize > >
428+ {
429+ Poll :: Ready ( StdIo :: Write :: write_vectored ( & mut self . get_mut ( ) . get_mut ( ) . as_mut ( ) , vec) )
430+ }
431+
416432 fn poll_flush ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) > > {
417433 Poll :: Ready ( StdIo :: Write :: flush ( & mut self . get_mut ( ) . get_mut ( ) . as_mut ( ) ) )
418434 }
0 commit comments