io: flush in AsyncWriteExt examples (#6149)

Closes: #6068
This commit is contained in:
Alice Ryhl 2023-11-14 20:13:00 +01:00 committed by GitHub
parent 2e5773a6fe
commit 06660ef00a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(())
/// }
/// ```