Skip to content

feature: Add drain_key_if and remove_key_if#2

Merged
imartayan merged 4 commits intoimartayan:mainfrom
shanecelis:drain_key_if
Jun 24, 2025
Merged

feature: Add drain_key_if and remove_key_if#2
imartayan merged 4 commits intoimartayan:mainfrom
shanecelis:drain_key_if

Conversation

@shanecelis
Copy link
Copy Markdown
Contributor

Thank you for the excellent crate. It's a perfect fit for what I wanted.

I added two functions drain_key_if and remove_key_if that I needed.

In making those work I also added an ExhaustIter behind the scenes that consumes an iterator even when it's dropped prematurely. Perhaps that's controversial. If you don't want that, let me know and I'll take it out.

Thank you for the crate!

@imartayan
Copy link
Copy Markdown
Owner

Hello @shanecelis, thank you for your contribution!
I think these functions are useful and having an exhaust iterator for drain_key_if is totally reasonable.
I will also update drain_key to do the same, it seems like a better default.

@imartayan imartayan merged commit 5bc6239 into imartayan:main Jun 24, 2025
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.

2 participants