Skip to content

IndexMap: add insert_full and Index<usize> - #686

Open
ChrisJr404 wants to merge 1 commit into
rust-embedded:mainfrom
ChrisJr404:indexmap-insert-full-index
Open

IndexMap: add insert_full and Index<usize>#686
ChrisJr404 wants to merge 1 commit into
rust-embedded:mainfrom
ChrisJr404:indexmap-insert-full-index

Conversation

@ChrisJr404

Copy link
Copy Markdown

This ports the index-oriented accessors from the upstream indexmap crate, as suggested in #325. insert_full behaves like insert but also hands back the entry's index, and Index<usize>/IndexMut<usize> let you read and write values by position with map[i]. Both round out the existing get_index family so you can refer to entries by position as well as by key.

Closes #325

Port the index-oriented accessors from the upstream indexmap crate so an
IndexMap can be inserted into and read back by position. insert_full returns
the entry index alongside the old value, and Index/IndexMut<usize> allow
map[i] lookups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add usize index methods to IndexMap

1 participant