@@ -13,6 +13,8 @@ pub use futures_io::{
13
13
AsyncRead , AsyncWrite , AsyncSeek , AsyncBufRead , Error , ErrorKind ,
14
14
IoSlice , IoSliceMut , Result , SeekFrom ,
15
15
} ;
16
+ #[ cfg( feature = "bytes" ) ]
17
+ pub use futures_io:: { Buf , BufMut } ;
16
18
17
19
#[ cfg( feature = "io-compat" ) ] use crate :: compat:: Compat ;
18
20
@@ -58,6 +60,11 @@ pub use self::read::Read;
58
60
mod read_vectored;
59
61
pub use self :: read_vectored:: ReadVectored ;
60
62
63
+ #[ cfg( feature = "bytes" ) ]
64
+ mod read_buf;
65
+ #[ cfg( feature = "bytes" ) ]
66
+ pub use self :: read_buf:: ReadBuf ;
67
+
61
68
mod read_exact;
62
69
pub use self :: read_exact:: ReadExact ;
63
70
@@ -91,6 +98,11 @@ pub use self::write::Write;
91
98
mod write_vectored;
92
99
pub use self :: write_vectored:: WriteVectored ;
93
100
101
+ #[ cfg( feature = "bytes" ) ]
102
+ mod write_buf;
103
+ #[ cfg( feature = "bytes" ) ]
104
+ pub use self :: write_buf:: WriteBuf ;
105
+
94
106
mod write_all;
95
107
pub use self :: write_all:: WriteAll ;
96
108
@@ -204,6 +216,17 @@ pub trait AsyncReadExt: AsyncRead {
204
216
ReadVectored :: new ( self , bufs)
205
217
}
206
218
219
+ /// Creates a future which will read from the `AsyncRead` into `buf`.
220
+ ///
221
+ /// The returned future will resolve to the number of bytes read once the read
222
+ /// operation is completed.
223
+ #[ cfg( feature = "bytes" ) ]
224
+ fn read_buf < ' a , B : BufMut > ( & ' a mut self , buf : & ' a mut B ) -> ReadBuf < ' a , Self , B >
225
+ where Self : Unpin ,
226
+ {
227
+ ReadBuf :: new ( self , buf)
228
+ }
229
+
207
230
/// Creates a future which will read exactly enough bytes to fill `buf`,
208
231
/// returning an error if end of file (EOF) is hit sooner.
209
232
///
@@ -446,6 +469,17 @@ pub trait AsyncWriteExt: AsyncWrite {
446
469
WriteVectored :: new ( self , bufs)
447
470
}
448
471
472
+ /// Creates a future which will write bytes from `buf` into the object.
473
+ ///
474
+ /// The returned future will resolve to the number of bytes written once the write
475
+ /// operation is completed.
476
+ #[ cfg( feature = "bytes" ) ]
477
+ fn write_buf < ' a , B : Buf > ( & ' a mut self , buf : & ' a mut B ) -> WriteBuf < ' a , Self , B >
478
+ where Self : Unpin ,
479
+ {
480
+ WriteBuf :: new ( self , buf)
481
+ }
482
+
449
483
/// Write data into this object.
450
484
///
451
485
/// Creates a future that will write the entire contents of the buffer `buf` into
0 commit comments