I have a Vec<(String, i64)> and need to iterate over the Strings and move them and then iterate over the i64s.
However, if I move the Strings I have to store the i64 again into another Vec:
let l: Vec<_> = l
.into_iter()
.map(|(string, int)| {
drop(string);
int
})
.collect();
for i in l {
process(i);
}
How can I iterate over the Strings and i64s separately without incurring any additional performance overhead.
The only solution I can think of at the moment that will not cause additional operations is to store the Strings and i64s separately.