mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-28 00:00:11 +02:00
io: remove poll_{read,write}_buf from traits (#2882)
These functions have object safety issues. It also has been decided to avoid vectored operations on the I/O traits. A later PR will bring back vectored operations on specific types that support them. Refs: #2879, #2716
This commit is contained in:
@@ -70,6 +70,8 @@ impl<R: AsyncRead> ReaderStream<R> {
|
||||
impl<R: AsyncRead> Stream for ReaderStream<R> {
|
||||
type Item = std::io::Result<Bytes>;
|
||||
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
use crate::util::poll_read_buf;
|
||||
|
||||
let mut this = self.as_mut().project();
|
||||
|
||||
let reader = match this.reader.as_pin_mut() {
|
||||
@@ -81,7 +83,7 @@ impl<R: AsyncRead> Stream for ReaderStream<R> {
|
||||
this.buf.reserve(CAPACITY);
|
||||
}
|
||||
|
||||
match reader.poll_read_buf(cx, &mut this.buf) {
|
||||
match poll_read_buf(cx, reader, &mut this.buf) {
|
||||
Poll::Pending => Poll::Pending,
|
||||
Poll::Ready(Err(err)) => {
|
||||
self.project().reader.set(None);
|
||||
|
||||
Reference in New Issue
Block a user