Skip to content

Commit

Permalink
FuturesOrdered: Use 64-bit index
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Dec 24, 2023
1 parent e4aa659 commit 04d01a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions futures-util/src/stream/futures_ordered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ pin_project! {
struct OrderWrapper<T> {
#[pin]
data: T, // A future or a future's output
index: isize,
// Use i64 for index since isize may overflow in 32-bit targets.
index: i64,
}
}

Expand Down Expand Up @@ -98,8 +99,8 @@ where
pub struct FuturesOrdered<T: Future> {
in_progress_queue: FuturesUnordered<OrderWrapper<T>>,
queued_outputs: BinaryHeap<OrderWrapper<T::Output>>,
next_incoming_index: isize,
next_outgoing_index: isize,
next_incoming_index: i64,
next_outgoing_index: i64,
}

impl<T: Future> Unpin for FuturesOrdered<T> {}
Expand Down

0 comments on commit 04d01a0

Please sign in to comment.