Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io: drop the Sized requirements from AsyncReadExt.read_buf #6169

Merged
merged 1 commit into from Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions tokio/src/io/util/async_read_ext.rs
Expand Up @@ -245,8 +245,8 @@ cfg_io_util! {
/// ```
fn read_buf<'a, B>(&'a mut self, buf: &'a mut B) -> ReadBuf<'a, Self, B>
where
Self: Sized + Unpin,
B: BufMut,
Self: Unpin,
B: BufMut + ?Sized,
{
read_buf(self, buf)
}
Expand Down
10 changes: 5 additions & 5 deletions tokio/src/io/util/read_buf.rs
Expand Up @@ -10,8 +10,8 @@ use std::task::{Context, Poll};

pub(crate) fn read_buf<'a, R, B>(reader: &'a mut R, buf: &'a mut B) -> ReadBuf<'a, R, B>
where
R: AsyncRead + Unpin,
B: BufMut,
R: AsyncRead + Unpin + ?Sized,
B: BufMut + ?Sized,
{
ReadBuf {
reader,
Expand All @@ -24,7 +24,7 @@ pin_project! {
/// Future returned by [`read_buf`](crate::io::AsyncReadExt::read_buf).
#[derive(Debug)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct ReadBuf<'a, R, B> {
pub struct ReadBuf<'a, R: ?Sized, B: ?Sized> {
reader: &'a mut R,
buf: &'a mut B,
#[pin]
Expand All @@ -34,8 +34,8 @@ pin_project! {

impl<R, B> Future for ReadBuf<'_, R, B>
where
R: AsyncRead + Unpin,
B: BufMut,
R: AsyncRead + Unpin + ?Sized,
B: BufMut + ?Sized,
{
type Output = io::Result<usize>;

Expand Down