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: implement AsyncBufRead for Join #6449

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
io: implement AsyncBufRead for Join
Fixes: #6446
  • Loading branch information
bharath-123 committed Apr 1, 2024
commit aec92ade0b37c87665e5e44acfbdc711dfdbacec
15 changes: 14 additions & 1 deletion tokio/src/io/join.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Join two values implementing `AsyncRead` and `AsyncWrite` into a single one.

use crate::io::{AsyncRead, AsyncWrite, ReadBuf};
use crate::io::{AsyncBufRead, AsyncRead, AsyncWrite, ReadBuf};

use std::io;
use std::pin::Pin;
Expand Down Expand Up @@ -115,3 +115,16 @@ where
self.writer.is_write_vectored()
}
}

impl<R, W> AsyncBufRead for Join<R, W>
where
R: AsyncBufRead,
{
fn poll_fill_buf(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<&[u8]>> {
self.project().reader.poll_fill_buf(cx)
}

fn consume(self: Pin<&mut Self>, amt: usize) {
self.project().reader.consume(amt)
}
}
Loading