summaryrefslogtreecommitdiffstats
path: root/tokio-util/src/codec
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-util/src/codec
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-util/src/codec')
-rw-r--r--tokio-util/src/codec/framed_impl.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/tokio-util/src/codec/framed_impl.rs b/tokio-util/src/codec/framed_impl.rs
index eb2e0d38..c161808f 100644
--- a/tokio-util/src/codec/framed_impl.rs
+++ b/tokio-util/src/codec/framed_impl.rs
@@ -118,6 +118,8 @@ where
type Item = Result<U::Item, U::Error>;
fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
+ use crate::util::poll_read_buf;
+
let mut pinned = self.project();
let state: &mut ReadFrame = pinned.state.borrow_mut();
loop {
@@ -148,7 +150,7 @@ where
// got room for at least one byte to read to ensure that we don't
// get a spurious 0 that looks like EOF
state.buffer.reserve(1);
- let bytect = match pinned.inner.as_mut().poll_read_buf(cx, &mut state.buffer)? {
+ let bytect = match poll_read_buf(cx, pinned.inner.as_mut(), &mut state.buffer)? {
Poll::Ready(ct) => ct,
Poll::Pending => return Poll::Pending,
};