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

Feature request: extract_if #242

Open
CastilloDel opened this issue Oct 31, 2022 · 3 comments · May be fixed by #308
Open

Feature request: extract_if #242

CastilloDel opened this issue Oct 31, 2022 · 3 comments · May be fixed by #308
Labels
waiting-for-std Changes waiting for stabilization in the standard library, so we can match the API.

Comments

@CastilloDel
Copy link

Would it be possible to implement an efficient drain_filter method for the IndexMaps and IndexSets that behaves like the one in std?

@cuviper
Copy link
Member

cuviper commented Nov 1, 2022

Ideally, we would wrap Vec::drain_filter, since that's how we store our items, but that method is still unstable. I'm not sure how hard it would be to redo that ourselves, but we do similar for the MSRV lack of Vec::retain_mut already. Then we would probably just rebuild the entire RawTable if anything was removed, just like we do for retain.

The other thing about drain_filter being unstable is that we generally want to match std's API here as much as possible, but that's subject to change until it's finally stabilized.

@CastilloDel
Copy link
Author

The other thing about drain_filter being unstable is that we generally want to match std's API here as much as possible, but that's subject to change until it's finally stabilized.

That makes sense, I guess it will be better for indexmap to wait until the API stabilizes

@cuviper cuviper added the waiting-for-std Changes waiting for stabilization in the standard library, so we can match the API. label Nov 16, 2022
@cuviper cuviper linked a pull request Feb 3, 2024 that will close this issue
@cuviper
Copy link
Member

cuviper commented Feb 3, 2024

Note that rust-lang/rust#59618 renamed it to extract_if.

I've opened a draft at #308, but I still want to wait for std to stabilize the API. I'm not using std in my implementation though, so we won't need to worry about MSRV.

@cuviper cuviper changed the title Feature request: drain_filter Feature request: extract_if Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-std Changes waiting for stabilization in the standard library, so we can match the API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants