-
Notifications
You must be signed in to change notification settings - Fork 52
Implement Drain and IntoIterator #62
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Milestone
Description
We should implement the Drain and IntoIterator traits on HashMap!
Part of what is tricky about Drain is the contract for what happens when the user "does something weird". For example, what happens if I write the following code:
std::mem::forget(map.drain());Is map now empty or full? What happens if I read one element and then drop the Drain? Take a look at hashbrown::RawDrain for some inspiration. I'm genuinely not sure what the best way to express this is a concurrent map.
@soruh began an implementation in #33, but it has since run out of time to work on it. It may still be useful to draw inspiration from though, and has a fair amount of good discussion around the challenges involved.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed