mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-03 00:00:05 +02:00
util: document cancel safety of SinkExt::send and StreamExt::next (#6417)
This commit is contained in:
@@ -20,10 +20,21 @@ pin_project! {
|
||||
/// You can create a `Framed` instance by using the [`Decoder::framed`] adapter, or
|
||||
/// by using the `new` function seen below.
|
||||
///
|
||||
/// # 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.
|
||||
/// * [`tokio_stream::StreamExt::next`]: This method is cancel safe. The returned
|
||||
/// future only holds onto a reference to the underlying stream, so dropping it will
|
||||
/// never lose a value.
|
||||
///
|
||||
/// [`Stream`]: futures_core::Stream
|
||||
/// [`Sink`]: futures_sink::Sink
|
||||
/// [`AsyncRead`]: tokio::io::AsyncRead
|
||||
/// [`Decoder::framed`]: crate::codec::Decoder::framed()
|
||||
/// [`futures_util::sink::SinkExt::send`]: futures_util::sink::SinkExt::send
|
||||
/// [`tokio_stream::StreamExt::next`]: https://docs.rs/tokio-stream/latest/tokio_stream/trait.StreamExt.html#method.next
|
||||
pub struct Framed<T, U> {
|
||||
#[pin]
|
||||
inner: FramedImpl<T, U, RWFrames>
|
||||
|
||||
Reference in New Issue
Block a user