io: document cancellation safety of AsyncWriteExt::flush (#7364)

This commit is contained in:
Oliver E. Anderson
2025-06-08 20:57:36 +02:00
committed by GitHub
parent 8259133ca0
commit 1d980145cb
+10
View File
@@ -1231,6 +1231,16 @@ cfg_io_util! {
/// It is considered an error if not all bytes could be written due to
/// I/O errors or EOF being reached.
///
/// # Cancel safety
///
/// This method is cancel safe.
///
/// If `flush` is used as the event in a [`tokio::select!`](crate::select)
/// statement and some other branch completes first, then the data in the
/// buffered data in this `AsyncWrite` may have been partially flushed.
/// However, it is guaranteed that the buffer is advanced by the amount of
/// bytes that have been partially flushed.
///
/// # Examples
///
/// ```no_run