From 06660ef00a56f9b133de5b67efa5a9696238ed05 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 14 Nov 2023 20:13:00 +0100 Subject: [PATCH] io: flush in `AsyncWriteExt` examples (#6149) Closes: #6068 --- tokio/src/io/util/async_write_ext.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tokio/src/io/util/async_write_ext.rs b/tokio/src/io/util/async_write_ext.rs index a9812d57e8d..2760e912930 100644 --- a/tokio/src/io/util/async_write_ext.rs +++ b/tokio/src/io/util/async_write_ext.rs @@ -117,6 +117,7 @@ cfg_io_util! { /// /// // Writes some prefix of the byte string, not necessarily all of it. /// file.write(b"some bytes").await?; + /// file.flush().await?; /// Ok(()) /// } /// ``` @@ -162,6 +163,7 @@ cfg_io_util! { /// ]; /// /// file.write_vectored(&bufs).await?; + /// file.flush().await?; /// /// Ok(()) /// } @@ -244,6 +246,7 @@ cfg_io_util! { /// // all of it. /// file.write_buf(&mut buffer).await?; /// } + /// file.flush().await?; /// /// Ok(()) /// } @@ -307,6 +310,7 @@ cfg_io_util! { /// let mut buffer = Cursor::new(b"data to write"); /// /// file.write_all_buf(&mut buffer).await?; + /// file.flush().await?; /// Ok(()) /// } /// ``` @@ -356,6 +360,7 @@ cfg_io_util! { /// let mut file = File::create("foo.txt").await?; /// /// file.write_all(b"some bytes").await?; + /// file.flush().await?; /// Ok(()) /// } /// ```