util: document cancel safety of SinkExt::send and StreamExt::next (#6417)

This commit is contained in:
M.Amin Rayej
2024-03-25 01:53:01 +03:30
committed by GitHub
parent 4565b81097
commit deff2524c3
3 changed files with 24 additions and 0 deletions
+7
View File
@@ -18,8 +18,15 @@ pin_project! {
/// For examples of how to use `FramedWrite` with a codec, see the
/// examples on the [`codec`] module.
///
/// # Cancellation safety
///
/// * [`futures_util::sink::SinkExt::send`]: if send is used as the event in a
/// `tokio::select!` statement and some other branch completes first, then it is
/// guaranteed that the message was not sent, but the message itself is lost.
///
/// [`Sink`]: futures_sink::Sink
/// [`codec`]: crate::codec
/// [`futures_util::sink::SinkExt::send`]: futures_util::sink::SinkExt::send
pub struct FramedWrite<T, E> {
#[pin]
inner: FramedImpl<T, E, WriteFrame>,