Skip to content

Commit 06660ef

Browse files
authored
io: flush in AsyncWriteExt examples (#6149)
Closes: #6068
1 parent 2e5773a commit 06660ef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tokio/src/io/util/async_write_ext.rs

+5
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ cfg_io_util! {
117117
///
118118
/// // Writes some prefix of the byte string, not necessarily all of it.
119119
/// file.write(b"some bytes").await?;
120+
/// file.flush().await?;
120121
/// Ok(())
121122
/// }
122123
/// ```
@@ -162,6 +163,7 @@ cfg_io_util! {
162163
/// ];
163164
///
164165
/// file.write_vectored(&bufs).await?;
166+
/// file.flush().await?;
165167
///
166168
/// Ok(())
167169
/// }
@@ -244,6 +246,7 @@ cfg_io_util! {
244246
/// // all of it.
245247
/// file.write_buf(&mut buffer).await?;
246248
/// }
249+
/// file.flush().await?;
247250
///
248251
/// Ok(())
249252
/// }
@@ -307,6 +310,7 @@ cfg_io_util! {
307310
/// let mut buffer = Cursor::new(b"data to write");
308311
///
309312
/// file.write_all_buf(&mut buffer).await?;
313+
/// file.flush().await?;
310314
/// Ok(())
311315
/// }
312316
/// ```
@@ -356,6 +360,7 @@ cfg_io_util! {
356360
/// let mut file = File::create("foo.txt").await?;
357361
///
358362
/// file.write_all(b"some bytes").await?;
363+
/// file.flush().await?;
359364
/// Ok(())
360365
/// }
361366
/// ```

0 commit comments

Comments
 (0)