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 splicing iterators #294

Merged
merged 1 commit into from
Jan 17, 2024
Merged

Add splicing iterators #294

merged 1 commit into from
Jan 17, 2024

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Jan 13, 2024

IndexMap::splice and IndexSet::splice will drain the specified
range, and then insert items from an iterator to replace that range.
This is like Vec::splice, except if any new keys match the retained
entries outside the range, then those keep their relative position.

Resolves #274.

`IndexMap::splice` and `IndexSet::splice` will drain the specified
range, and then insert items from an iterator to replace that range.
This is like `Vec::splice`, except if any new keys match the retained
entries outside the range, then those keep their relative position.
@cuviper
Copy link
Member Author

cuviper commented Jan 17, 2024

It might be possible to optimize this with some unsafe hacking, but I think this is pretty reasonable for now.

@cuviper cuviper added this pull request to the merge queue Jan 17, 2024
Merged via the queue into indexmap-rs:master with commit 282ba6e Jan 17, 2024
15 checks passed
@cuviper cuviper deleted the splice branch January 25, 2024 05:12
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: Similar method to Vec.splice
1 participant