summaryrefslogtreecommitdiffstats
path: root/third_party/rust/cc/src/parallel/mod.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /third_party/rust/cc/src/parallel/mod.rs
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/cc/src/parallel/mod.rs')
-rw-r--r--third_party/rust/cc/src/parallel/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/third_party/rust/cc/src/parallel/mod.rs b/third_party/rust/cc/src/parallel/mod.rs
new file mode 100644
index 0000000000..d69146dc59
--- /dev/null
+++ b/third_party/rust/cc/src/parallel/mod.rs
@@ -0,0 +1,20 @@
+pub(crate) mod async_executor;
+pub(crate) mod job_token;
+pub(crate) mod stderr;
+
+/// Remove all element in `vec` which `f(element)` returns `false`.
+///
+/// TODO: Remove this once the MSRV is bumped to v1.61
+pub(crate) fn retain_unordered_mut<T, F>(vec: &mut Vec<T>, mut f: F)
+where
+ F: FnMut(&mut T) -> bool,
+{
+ let mut i = 0;
+ while i < vec.len() {
+ if f(&mut vec[i]) {
+ i += 1;
+ } else {
+ vec.swap_remove(i);
+ }
+ }
+}