summaryrefslogtreecommitdiffstats
path: root/tokio/src/io/util/read_buf.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2020-09-24 17:26:03 -0700
committerGitHub <noreply@github.com>2020-09-24 17:26:03 -0700
commit4186b0aa38abbec7670d53882d5cdfd4b12add5c (patch)
treeb067117fcb1a4c479cd274465bcac0431c2e59f7 /tokio/src/io/util/read_buf.rs
parent760ae89401d9addb71ebf19674980577b5501edd (diff)
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
Diffstat (limited to 'tokio/src/io/util/read_buf.rs')
-rw-r--r--tokio/src/io/util/read_buf.rs38
1 files changed, 0 insertions, 38 deletions
diff --git a/tokio/src/io/util/read_buf.rs b/tokio/src/io/util/read_buf.rs
deleted file mode 100644
index 6ee3d249..00000000
--- a/tokio/src/io/util/read_buf.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-use crate::io::AsyncRead;
-
-use bytes::BufMut;
-use std::future::Future;
-use std::io;
-use std::pin::Pin;
-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,
-{
- ReadBuf { reader, buf }
-}
-
-cfg_io_util! {
- /// 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> {
- reader: &'a mut R,
- buf: &'a mut B,
- }
-}
-
-impl<R, B> Future for ReadBuf<'_, R, B>
-where
- R: AsyncRead + Unpin,
- B: BufMut,
-{
- type Output = io::Result<usize>;
-
- fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<usize>> {
- let me = &mut *self;
- Pin::new(&mut *me.reader).poll_read_buf(cx, me.buf)
- }
-}