1 | pub(crate) mod async_executor; |
---|---|
2 | pub(crate) mod job_token; |
3 | pub(crate) mod stderr; |
4 | |
5 | /// Remove all element in `vec` which `f(element)` returns `false`. |
6 | /// |
7 | /// TODO: Remove this once the MSRV is bumped to v1.61 |
8 | pub(crate) fn retain_unordered_mut<T, F>(vec: &mut Vec<T>, mut f: F) |
9 | where |
10 | F: FnMut(&mut T) -> bool, |
11 | { |
12 | let mut i: usize = 0; |
13 | while i < vec.len() { |
14 | if f(&mut vec[i]) { |
15 | i += 1; |
16 | } else { |
17 | vec.swap_remove(index:i); |
18 | } |
19 | } |
20 | } |
21 |