Closed
Description
#132 added usize-based indexing for the values in an IndexMap, which is absolutely the correct behavior for Index<usize>
to have. However, sometimes I want to get either just the key or a key-value pair at a particular index, and get_index
is a verbose way to do that if I know the index is valid. A possible alternate spelling would be map.keys()[idx]
, implemented by providing Index<usize>
on Keys.
Of course, this particular approach means that indexing would be valid even after consuming some of the keys, even if that's not the recommended use, and the code needs to decide and document what that means.
Metadata
Metadata
Assignees
Labels
No labels