Transpose `HashMap<K, Vec<T>>` to `Vec<HashMap<K, T>>`
Author: krakow10Created Jun 19, 2026Updated Jun 23, 2026
What would be the best way to achieve this with rayon? HashMap is small ~60 and Vec is large ~60000 and K is Copy. My first thought was to implement the IntoParallelIterator and Producer traits manually with a wrapper type and use a HashMap of rayon::vec::DrainProducers for splitting, but DrainProducer is not in the public interface. Am I missing something obvious? I'm also looking to solve this for transposing a struct-of-arrays to array-of-structs.
Edit: I couldn't think of any other way to do it, but my I wrote an implementation and my idea works!
Source: rayon-rs/rayon