summaryrefslogtreecommitdiffstats
path: root/tokio/tests/io_split.rs
diff options
context:
space:
mode:
authorSean McArthur <sean@seanmonstar.com>2020-08-13 20:15:01 -0700
committerGitHub <noreply@github.com>2020-08-13 20:15:01 -0700
commitc393236dfd12c13e82badd631d3a3a90481c6f95 (patch)
tree47e7e70b7a58fb968870d5d44e95f6c45192e114 /tokio/tests/io_split.rs
parent71da06097bf9aa851ebdde79d7b01a3e38174db9 (diff)
io: change AsyncRead to use a ReadBuf (#2758)
Works towards #2716. Changes the argument to `AsyncRead::poll_read` to take a `ReadBuf` struct that safely manages writes to uninitialized memory.
Diffstat (limited to 'tokio/tests/io_split.rs')
-rw-r--r--tokio/tests/io_split.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/tokio/tests/io_split.rs b/tokio/tests/io_split.rs
index e54bf248..7b401424 100644
--- a/tokio/tests/io_split.rs
+++ b/tokio/tests/io_split.rs
@@ -1,7 +1,7 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
-use tokio::io::{split, AsyncRead, AsyncWrite, ReadHalf, WriteHalf};
+use tokio::io::{split, AsyncRead, AsyncWrite, ReadBuf, ReadHalf, WriteHalf};
use std::io;
use std::pin::Pin;
@@ -13,9 +13,10 @@ impl AsyncRead for RW {
fn poll_read(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
- _buf: &mut [u8],
- ) -> Poll<io::Result<usize>> {
- Poll::Ready(Ok(1))
+ buf: &mut ReadBuf<'_>,
+ ) -> Poll<io::Result<()>> {
+ buf.append(&[b'z']);
+ Poll::Ready(Ok(()))
}
}