Skip to content

feature request: iter_by_ values mapped to a single index value #64

Description

@dknopik

Currently, the iter_by_ methods for non-unique indices work by iterating over all index values and then iterating over the values associated to each index. So basically, the difference to a simple iter is that the values will be ordered differently: with `iter_by_´, they will be grouped by index.

However, this is not that useful to my use case. When I saw that there are iter_by_ functions (without checking the full signature), I assumed that they worked like this: accept a value for the corresponding index and iterate to all map values associated to it. Basically, first look up the indices of the map values for the desired index value (through a simple hash map retrieval), then return an iterator used to iterate over the corresponding map values.

This is more efficient than the current iter_by_ methods as we do not have to filter for the desired index first. Effectively, the described functionality above would be the same as get_by_*().into_iter(), except that it avoids allocating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions