File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -20,10 +20,21 @@ pin_project! {
2020 /// You can create a `Framed` instance by using the [`Decoder::framed`] adapter, or
2121 /// by using the `new` function seen below.
2222 ///
23+ /// # Cancellation safety
24+ ///
25+ /// * [`futures_util::sink::SinkExt::send`]: if send is used as the event in a
26+ /// `tokio::select!` statement and some other branch completes first, then it is
27+ /// guaranteed that the message was not sent, but the message itself is lost.
28+ /// * [`tokio_stream::StreamExt::next`]: This method is cancel safe. The returned
29+ /// future only holds onto a reference to the underlying stream, so dropping it will
30+ /// never lose a value.
31+ ///
2332 /// [`Stream`]: futures_core::Stream
2433 /// [`Sink`]: futures_sink::Sink
2534 /// [`AsyncRead`]: tokio::io::AsyncRead
2635 /// [`Decoder::framed`]: crate::codec::Decoder::framed()
36+ /// [`futures_util::sink::SinkExt::send`]: futures_util::sink::SinkExt::send
37+ /// [`tokio_stream::StreamExt::next`]: https://docs.rs/tokio-stream/latest/tokio_stream/trait.StreamExt.html#method.next
2738 pub struct Framed <T , U > {
2839 #[ pin]
2940 inner: FramedImpl <T , U , RWFrames >
Original file line number Diff line number Diff line change @@ -17,9 +17,15 @@ pin_project! {
1717 /// For examples of how to use `FramedRead` with a codec, see the
1818 /// examples on the [`codec`] module.
1919 ///
20+ /// # Cancellation safety
21+ /// * [`tokio_stream::StreamExt::next`]: This method is cancel safe. The returned
22+ /// future only holds onto a reference to the underlying stream, so dropping it will
23+ /// never lose a value.
24+ ///
2025 /// [`Stream`]: futures_core::Stream
2126 /// [`AsyncRead`]: tokio::io::AsyncRead
2227 /// [`codec`]: crate::codec
28+ /// [`tokio_stream::StreamExt::next`]: https://docs.rs/tokio-stream/latest/tokio_stream/trait.StreamExt.html#method.next
2329 pub struct FramedRead <T , D > {
2430 #[ pin]
2531 inner: FramedImpl <T , D , ReadFrame >,
Original file line number Diff line number Diff line change @@ -18,8 +18,15 @@ pin_project! {
1818 /// For examples of how to use `FramedWrite` with a codec, see the
1919 /// examples on the [`codec`] module.
2020 ///
21+ /// # Cancellation safety
22+ ///
23+ /// * [`futures_util::sink::SinkExt::send`]: if send is used as the event in a
24+ /// `tokio::select!` statement and some other branch completes first, then it is
25+ /// guaranteed that the message was not sent, but the message itself is lost.
26+ ///
2127 /// [`Sink`]: futures_sink::Sink
2228 /// [`codec`]: crate::codec
29+ /// [`futures_util::sink::SinkExt::send`]: futures_util::sink::SinkExt::send
2330 pub struct FramedWrite <T , E > {
2431 #[ pin]
2532 inner: FramedImpl <T , E , WriteFrame >,
You can’t perform that action at this time.
0 commit comments