We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
clear
1 parent 173c9f8 commit 3a80c14Copy full SHA for 3a80c14
futures-util/src/stream/futures_ordered.rs
@@ -169,6 +169,17 @@ impl<Fut: Future> FuturesOrdered<Fut> {
169
self.next_outgoing_index -= 1;
170
self.in_progress_queue.push(wrapped);
171
}
172
+
173
+ /// Clear the whole `FuturesOrdered` queue.
174
+ ///
175
+ /// This function clears the pending futures and the queued outputs
176
+ /// to make it fully empty.
177
+ pub fn clear(&mut self) {
178
+ self.in_progress_queue.clear();
179
+ self.queued_outputs.clear();
180
+ self.next_incoming_index = 0;
181
+ self.next_outgoing_index = 0;
182
+ }
183
184
185
impl<Fut: Future> Default for FuturesOrdered<Fut> {
0 commit comments