1111#![ doc( html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.14/futures_io" ) ]
1212
1313#![ feature( futures_api) ]
14- #![ cfg_attr( feature = "std" , feature( iovec) ) ]
14+ #![ cfg_attr( feature = "iovec" , feature( iovec) ) ]
15+
16+ #[ cfg( all( feature = "iovec" , not( feature = "nightly" ) ) ) ]
17+ compile_error ! ( "The `iovec` feature requires the `nightly` feature as an explicit opt-in to unstable features" ) ;
1518
1619#[ cfg( feature = "std" ) ]
1720mod if_std {
@@ -23,6 +26,7 @@ mod if_std {
2326 use std:: ptr;
2427
2528 // Re-export IoVec and IoVecMut for convenience
29+ #[ cfg( feature = "iovec" ) ]
2630 pub use self :: StdIo :: { IoVec , IoVecMut } ;
2731
2832 // Re-export io::Error so that users don't have to deal
@@ -135,6 +139,7 @@ mod if_std {
135139 /// `Interrupted`. Implementations must convert `WouldBlock` into
136140 /// `Poll::Pending` and either internally retry or convert
137141 /// `Interrupted` into another error kind.
142+ #[ cfg( feature = "iovec" ) ]
138143 fn poll_vectored_read ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ IoVecMut < ' _ > ] )
139144 -> Poll < Result < usize > >
140145 {
@@ -196,6 +201,7 @@ mod if_std {
196201 /// `Interrupted`. Implementations must convert `WouldBlock` into
197202 /// `Poll::Pending` and either internally retry or convert
198203 /// `Interrupted` into another error kind.
204+ #[ cfg( feature = "iovec" ) ]
199205 fn poll_vectored_write ( self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & [ IoVec < ' _ > ] )
200206 -> Poll < Result < usize > >
201207 {
@@ -255,6 +261,7 @@ mod if_std {
255261 Pin :: new( & mut * * self ) . poll_read( cx, buf)
256262 }
257263
264+ #[ cfg( feature = "iovec" ) ]
258265 fn poll_vectored_read( mut self : Pin <& mut Self >, cx: & mut Context <' _>, vec: & mut [ IoVecMut <' _>] )
259266 -> Poll <Result <usize >>
260267 {
@@ -282,6 +289,7 @@ mod if_std {
282289 T :: poll_read ( ( * self ) . as_mut ( ) , cx, buf)
283290 }
284291
292+ #[ cfg( feature = "iovec" ) ]
285293 fn poll_vectored_read ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & mut [ IoVecMut < ' _ > ] )
286294 -> Poll < Result < usize > >
287295 {
@@ -302,6 +310,13 @@ mod if_std {
302310 {
303311 Poll :: Ready ( StdIo :: Read :: read( & mut * self , buf) )
304312 }
313+
314+ #[ cfg( feature = "iovec" ) ]
315+ fn poll_vectored_read( mut self : Pin <& mut Self >, _: & mut Context <' _>, vec: & mut [ IoVecMut <' _>] )
316+ -> Poll <Result <usize >>
317+ {
318+ Poll :: Ready ( StdIo :: Read :: read_vectored( & mut * self , vec) )
319+ }
305320 }
306321 }
307322
@@ -325,6 +340,7 @@ mod if_std {
325340 Pin :: new( & mut * * self ) . poll_write( cx, buf)
326341 }
327342
343+ #[ cfg( feature = "iovec" ) ]
328344 fn poll_vectored_write( mut self : Pin <& mut Self >, cx: & mut Context <' _>, vec: & [ IoVec <' _>] )
329345 -> Poll <Result <usize >>
330346 {
@@ -356,6 +372,7 @@ mod if_std {
356372 T :: poll_write ( ( * self ) . as_mut ( ) , cx, buf)
357373 }
358374
375+ #[ cfg( feature = "iovec" ) ]
359376 fn poll_vectored_write ( mut self : Pin < & mut Self > , cx : & mut Context < ' _ > , vec : & [ IoVec < ' _ > ] )
360377 -> Poll < Result < usize > >
361378 {
@@ -379,6 +396,13 @@ mod if_std {
379396 Poll :: Ready ( StdIo :: Write :: write( & mut * self , buf) )
380397 }
381398
399+ #[ cfg( feature = "iovec" ) ]
400+ fn poll_vectored_write( mut self : Pin <& mut Self >, _: & mut Context <' _>, vec: & [ IoVec <' _>] )
401+ -> Poll <Result <usize >>
402+ {
403+ Poll :: Ready ( StdIo :: Write :: write_vectored( & mut * self , vec) )
404+ }
405+
382406 fn poll_flush( mut self : Pin <& mut Self >, _: & mut Context <' _>) -> Poll <Result <( ) >> {
383407 Poll :: Ready ( StdIo :: Write :: flush( & mut * self ) )
384408 }
@@ -407,6 +431,13 @@ mod if_std {
407431 Poll :: Ready ( result)
408432 }
409433
434+ #[ cfg( feature = "iovec" ) ]
435+ fn poll_vectored_write ( self : Pin < & mut Self > , _: & mut Context < ' _ > , vec : & [ IoVec < ' _ > ] )
436+ -> Poll < Result < usize > >
437+ {
438+ Poll :: Ready ( StdIo :: Write :: write_vectored ( & mut self . get_mut ( ) . get_mut ( ) . as_mut ( ) , vec) )
439+ }
440+
410441 fn poll_flush ( self : Pin < & mut Self > , _: & mut Context < ' _ > ) -> Poll < Result < ( ) > > {
411442 Poll :: Ready ( StdIo :: Write :: flush ( & mut self . get_mut ( ) . get_mut ( ) . as_mut ( ) ) )
412443 }
0 commit comments