From 008e8bbe0442bda1b3c8708e974c244320f73af2 Mon Sep 17 00:00:00 2001 From: Alex Konradi Date: Wed, 13 Nov 2024 14:42:34 -0500 Subject: [PATCH] Document cancel-safety of StreamExt::next --- futures-util/src/stream/stream/mod.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/futures-util/src/stream/stream/mod.rs b/futures-util/src/stream/stream/mod.rs index ee30f8da6f..a79e0bd6ff 100644 --- a/futures-util/src/stream/stream/mod.rs +++ b/futures-util/src/stream/stream/mod.rs @@ -232,6 +232,12 @@ pub trait StreamExt: Stream { /// pinning it to the stack using the `pin_mut!` macro from the `pin_utils` /// crate. /// + /// # Cancel safety + /// + /// The returned future only holds a reference to the underlying stream, and + /// so is cancel safe (assuming the stream is also cancel-safe). If it is + /// dropped before it resolves, no item from the stream will be dropped. + /// /// # Examples /// /// ```