Take the following data type:
let mut items = HashMap::<u64, HashMap<u64, bool>>::new();
I successfully managed to turn it into a vector of tuples like this:
let mut vector_of_tuples: Vec<(u64, u64, bool)> = vec![];
for (outer_id, inner_hash_map) in items.iter() {
for (inner_id, state) in inner_hash_map.iter() {
vector_of_tuples.push((*outer_id, *inner_id, *state));
}
}
But I want to shrink this code logic, possibly with the help of the Map and Zip functions from the Rust standard library.
How can I achieve the same result without using for loops?