Skip to content

Add map and set extract_if#308

Merged
cuviper merged 5 commits intoindexmap-rs:mainfrom
cuviper:extract_if
Jun 26, 2025
Merged

Add map and set extract_if#308
cuviper merged 5 commits intoindexmap-rs:mainfrom
cuviper:extract_if

Conversation

@cuviper
Copy link
Copy Markdown
Member

@cuviper cuviper commented Feb 3, 2024

No description provided.

@cuviper cuviper added the waiting-for-std Changes waiting for stabilization in the standard library, so we can match the API. label Feb 3, 2024
@cuviper cuviper linked an issue Feb 3, 2024 that may be closed by this pull request

if new_len != old_len {
// We don't keep track of *which* items were extracted, so reindex everything.
self.map.rebuild_hash_table();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it would be nice to reuse vec::ExtractIf, I haven't found a way to do this fixup for the indices afterward, because that vec::ExtractIf would be holding &mut on the entries, excluding even a raw pointer elsewhere.

@cuviper cuviper removed the waiting-for-std Changes waiting for stabilization in the standard library, so we can match the API. label Jun 26, 2025
@cuviper cuviper marked this pull request as ready for review June 26, 2025 18:37
@cuviper cuviper added this pull request to the merge queue Jun 26, 2025
Merged via the queue into indexmap-rs:main with commit 37e519a Jun 26, 2025
15 checks passed
@cuviper cuviper deleted the extract_if branch August 21, 2025 19:30
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: extract_if

1 participant