Skip to content

Commit 161c3d5

Browse files
committed
Make access to inner of futures::io::{BufReader,BufWriter} not require
inner trait bound
1 parent 48b58c0 commit 161c3d5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

futures-util/src/io/buf_reader.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ pin_project! {
3939
}
4040
}
4141

42+
impl<R> BufReader<R> {
43+
delegate_access_inner!(inner, R, ());
44+
}
45+
4246
impl<R: AsyncRead> BufReader<R> {
4347
/// Creates a new `BufReader` with a default buffer capacity. The default is currently 8 KB,
4448
/// but may change in the future.
@@ -53,8 +57,6 @@ impl<R: AsyncRead> BufReader<R> {
5357
Self { inner, buffer: buffer.into_boxed_slice(), pos: 0, cap: 0 }
5458
}
5559

56-
delegate_access_inner!(inner, R, ());
57-
5860
/// Returns a reference to the internally buffered data.
5961
///
6062
/// Unlike `fill_buf`, this will not attempt to fill the buffer if it is empty.

futures-util/src/io/buf_writer.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ pin_project! {
3939
}
4040
}
4141

42+
impl<W> BufWriter<W> {
43+
delegate_access_inner!(inner, W, ());
44+
}
45+
4246
impl<W: AsyncWrite> BufWriter<W> {
4347
/// Creates a new `BufWriter` with a default buffer capacity. The default is currently 8 KB,
4448
/// but may change in the future.
@@ -79,8 +83,6 @@ impl<W: AsyncWrite> BufWriter<W> {
7983
Poll::Ready(ret)
8084
}
8185

82-
delegate_access_inner!(inner, W, ());
83-
8486
/// Returns a reference to the internally buffered data.
8587
pub fn buffer(&self) -> &[u8] {
8688
&self.buf

0 commit comments

Comments
 (0)