1111#![ doc( html_root_url = "https://rust-lang-nursery.github.io/futures-api-docs/0.3.0-alpha.13/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 /// `Async::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 > , waker : & Waker , vec : & mut [ IoVecMut < ' _ > ] )
139144 -> Poll < Result < usize > >
140145 {
@@ -196,6 +201,7 @@ mod if_std {
196201 /// `Interrupted`. Implementations must convert `WouldBlock` into
197202 /// `Async::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 > , waker : & Waker , vec : & [ IoVec < ' _ > ] )
200206 -> Poll < Result < usize > >
201207 {
@@ -255,6 +261,7 @@ mod if_std {
255261 Pin :: new( & mut * * self ) . poll_read( waker, buf)
256262 }
257263
264+ #[ cfg( feature = "iovec" ) ]
258265 fn poll_vectored_read( mut self : Pin <& mut Self >, waker: & Waker , vec: & mut [ IoVecMut <' _>] )
259266 -> Poll <Result <usize >>
260267 {
@@ -284,6 +291,13 @@ mod if_std {
284291 {
285292 Poll :: Ready ( StdIo :: Read :: read( & mut * self , buf) )
286293 }
294+
295+ #[ cfg( feature = "iovec" ) ]
296+ fn poll_vectored_read( mut self : Pin <& mut Self >, _: & Waker , vec: & mut [ IoVecMut <' _>] )
297+ -> Poll <Result <usize >>
298+ {
299+ Poll :: Ready ( StdIo :: Read :: read_vectored( & mut * self , vec) )
300+ }
287301 }
288302 }
289303
@@ -307,6 +321,7 @@ mod if_std {
307321 Pin :: new( & mut * * self ) . poll_write( waker, buf)
308322 }
309323
324+ #[ cfg( feature = "iovec" ) ]
310325 fn poll_vectored_write( mut self : Pin <& mut Self >, waker: & Waker , vec: & [ IoVec <' _>] )
311326 -> Poll <Result <usize >>
312327 {
@@ -338,6 +353,7 @@ mod if_std {
338353 T :: poll_write ( ( * self ) . as_mut ( ) , waker, buf)
339354 }
340355
356+ #[ cfg( feature = "iovec" ) ]
341357 fn poll_vectored_write ( mut self : Pin < & mut Self > , waker : & Waker , vec : & [ IoVec < ' _ > ] )
342358 -> Poll < Result < usize > >
343359 {
@@ -361,6 +377,13 @@ mod if_std {
361377 Poll :: Ready ( StdIo :: Write :: write( & mut * self , buf) )
362378 }
363379
380+ #[ cfg( feature = "iovec" ) ]
381+ fn poll_vectored_write( mut self : Pin <& mut Self >, _: & Waker , vec: & [ IoVec <' _>] )
382+ -> Poll <Result <usize >>
383+ {
384+ Poll :: Ready ( StdIo :: Write :: write_vectored( & mut * self , vec) )
385+ }
386+
364387 fn poll_flush( mut self : Pin <& mut Self >, _: & Waker ) -> Poll <Result <( ) >> {
365388 Poll :: Ready ( StdIo :: Write :: flush( & mut * self ) )
366389 }
@@ -389,6 +412,13 @@ mod if_std {
389412 Poll :: Ready ( result)
390413 }
391414
415+ #[ cfg( feature = "iovec" ) ]
416+ fn poll_vectored_write ( self : Pin < & mut Self > , _: & Waker , vec : & [ IoVec < ' _ > ] )
417+ -> Poll < Result < usize > >
418+ {
419+ Poll :: Ready ( StdIo :: Write :: write_vectored ( & mut self . get_mut ( ) . get_mut ( ) . as_mut ( ) , vec) )
420+ }
421+
392422 fn poll_flush ( self : Pin < & mut Self > , _: & Waker ) -> Poll < Result < ( ) > > {
393423 Poll :: Ready ( StdIo :: Write :: flush ( & mut self . get_mut ( ) . get_mut ( ) . as_mut ( ) ) )
394424 }
0 commit comments