Skip to content

Transpose HashMap<K, Vec<T>> to Vec<HashMap<K, T>> #1304

Description

@krakow10

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions