Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions futures-util/src/stream/futures_unordered/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ use self::ready_to_run_queue::{Dequeue, ReadyToRunQueue};
///
/// This type is only available when the `std` or `alloc` feature of this
/// library is activated, and it is activated by default.
///
/// # Cancel safety
///
/// This type is cancellation-safe. If [`poll_next`](Stream::poll_next) is
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it cancellation-safe independent of the inner type?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. I think not; if the inner future type F shouldn't be dropped before it resolves, then a FuturesUnordered<F> shouldn't be dropped before it's empty. I'll update the PR.

/// called (either directly or via [`crate::StreamExt::next`]) and it returns
/// [`Poll::Pending`], no values will be dropped if `poll_next` is not called
/// again.
#[must_use = "streams do nothing unless polled"]
pub struct FuturesUnordered<Fut> {
ready_to_run_queue: Arc<ReadyToRunQueue<Fut>>,
Expand Down