Skip to content

Commit

Permalink
Make access inner of futures::io::{BufReader,BufWriter} not require
Browse files Browse the repository at this point in the history
inner trait bound
  • Loading branch information
ethe committed Mar 31, 2024
1 parent 48b58c0 commit fac149e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions futures-util/src/io/buf_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ pin_project! {
}
}

impl<R> BufReader<R> {
delegate_access_inner!(inner, R, ());
}

impl<R: AsyncRead> BufReader<R> {
/// Creates a new `BufReader` with a default buffer capacity. The default is currently 8 KB,
/// but may change in the future.
Expand All @@ -53,8 +57,6 @@ impl<R: AsyncRead> BufReader<R> {
Self { inner, buffer: buffer.into_boxed_slice(), pos: 0, cap: 0 }
}

delegate_access_inner!(inner, R, ());

/// Returns a reference to the internally buffered data.
///
/// Unlike `fill_buf`, this will not attempt to fill the buffer if it is empty.
Expand Down
6 changes: 4 additions & 2 deletions futures-util/src/io/buf_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ pin_project! {
}
}

impl<W> BufWriter<W> {
delegate_access_inner!(inner, W, ());
}

impl<W: AsyncWrite> BufWriter<W> {
/// Creates a new `BufWriter` with a default buffer capacity. The default is currently 8 KB,
/// but may change in the future.
Expand Down Expand Up @@ -79,8 +83,6 @@ impl<W: AsyncWrite> BufWriter<W> {
Poll::Ready(ret)
}

delegate_access_inner!(inner, W, ());

/// Returns a reference to the internally buffered data.
pub fn buffer(&self) -> &[u8] {
&self.buf
Expand Down

0 comments on commit fac149e

Please sign in to comment.