From 33d6d4f63c080768c4d174c78e8384b73fa0b8db Mon Sep 17 00:00:00 2001 From: avdb <60188643+avdb13@users.noreply.github.com> Date: Sun, 16 Jul 2023 17:11:05 +0300 Subject: [PATCH] io: use vec in example for `AsyncReadExt::read_exact` (#5863) --- tokio/src/io/util/async_read_ext.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tokio/src/io/util/async_read_ext.rs b/tokio/src/io/util/async_read_ext.rs index df5445c2c65..3201f1dd08d 100644 --- a/tokio/src/io/util/async_read_ext.rs +++ b/tokio/src/io/util/async_read_ext.rs @@ -292,7 +292,8 @@ cfg_io_util! { /// #[tokio::main] /// async fn main() -> io::Result<()> { /// let mut f = File::open("foo.txt").await?; - /// let mut buffer = [0; 10]; + /// let len = 10; + /// let mut buffer = vec![0; len]; /// /// // read exactly 10 bytes /// f.read_exact(&mut buffer).await?;