Just wondering if there is a more functional / rustic approach to retaining both indices and values from a vector whose value satisfy a condition.

Working snippet as follows:

```
fn main() {
let x = vec![1, 2, 3, 4];
let mut indices = vec![];
let mut keepers = vec![];
for (i, v) in x.iter().enumerate() {
if v % 2 == 0 {
keepers.push(v);
indices.push(i);
}
}
// println!("{:?}-{:?}", indices, keepers);
}
```

Of course I can easily get the values by making `x`

mutable and using `x.retain`

, but would also like to know which indices have either been kept or lost in the process.