Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more indexed methods to entries #310

Merged
merged 8 commits into from
Feb 11, 2024
Merged

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Feb 10, 2024

For IndexedEntry, OccupiedEntry, and RawOccupiedEntryMut, this
adds move_index and swap_indices methods that work like the
top-level IndexMap methods using the current index of the entry.

For VacantEntry this adds shift_insert, while RawVacantEntryMut
adds shift_insert and shift_insert_hashed_nocheck, offering a way to
insert at a particular index while shifting other entries as needed.

Finally, for IndexMap and IndexSet this adds shift_insert using
OccupiedEntry::move_index or VacantEntry::shift_insert.

@cuviper cuviper linked an issue Feb 10, 2024 that may be closed by this pull request
@cuviper cuviper marked this pull request as ready for review February 11, 2024 04:36
For `IndexedEntry`, `OccupiedEntry`, and `RawOccupiedEntryMut`, this
adds `move_index` and `swap_indices` methods that work like the
top-level `IndexMap` methods using the current index of the entry.

For `VacantEntry` this adds `shift_insert`, while `RawVacantEntryMut`
adds `shift_insert` and `shift_insert_hashed_nocheck`, offering a way to
insert at a particular index while shifting other entries as needed.
@cuviper cuviper added this pull request to the merge queue Feb 11, 2024
Merged via the queue into indexmap-rs:master with commit 8e6753c Feb 11, 2024
15 checks passed
@cuviper cuviper deleted the shift_insert branch February 13, 2024 21:58
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.

Feature request: shift_insert
1 participant