io: implement AsyncBufRead for Join (#6449)

Fixes: #6446
This commit is contained in:
Bharath Vedartham
2024-04-02 13:00:44 +02:00
committed by GitHub
parent d298049299
commit e9ae5d4ce9
+14 -1
View File
@@ -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;
@@ -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)
}
}