diff options
author | Carl Lerche <me@carllerche.com> | 2020-09-24 17:26:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-24 17:26:03 -0700 |
commit | 4186b0aa38abbec7670d53882d5cdfd4b12add5c (patch) | |
tree | b067117fcb1a4c479cd274465bcac0431c2e59f7 /tokio/src/io/async_write.rs | |
parent | 760ae89401d9addb71ebf19674980577b5501edd (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/async_write.rs')
-rw-r--r-- | tokio/src/io/async_write.rs | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/tokio/src/io/async_write.rs b/tokio/src/io/async_write.rs index ecf7575b..66ba4bf3 100644 --- a/tokio/src/io/async_write.rs +++ b/tokio/src/io/async_write.rs @@ -1,4 +1,3 @@ -use bytes::Buf; use std::io; use std::ops::DerefMut; use std::pin::Pin; @@ -128,27 +127,6 @@ pub trait AsyncWrite { /// This function will panic if not called within the context of a future's /// task. fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), io::Error>>; - - /// Writes a `Buf` into this value, returning how many bytes were written. - /// - /// Note that this method will advance the `buf` provided automatically by - /// the number of bytes written. - fn poll_write_buf<B: Buf>( - self: Pin<&mut Self>, - cx: &mut Context<'_>, - buf: &mut B, - ) -> Poll<Result<usize, io::Error>> - where - Self: Sized, - { - if !buf.has_remaining() { - return Poll::Ready(Ok(0)); - } - - let n = ready!(self.poll_write(cx, buf.bytes()))?; - buf.advance(n); - Poll::Ready(Ok(n)) - } } macro_rules! deref_async_write { |