jonhoo / flurry

A port of Java's ConcurrentHashMap to Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement `HashSet::replace`

GarkGarcia opened this issue · comments

Std's HashSet exposes the HashSet::replace method, which is useful for situations where == potentially returns true even if it's arguments are structurally different. This should be a very trivial to fix.

Also, it should be easy to implement HashSet::is_subset and HashSet::is_superset equivalents.

I'll work on this and #17 as soon as we're done with #74.

I don't think implementing HashSet::replace is viable, since HashMap::put always leaves the key unchanged. I guess this should be closed?

Ah, yes, you're right... That's awkward. I guess the user would have to remove and then re-add. Which we probably want them to do explicitly. In theory we could also make the key an Atomic, but that seems like more trouble than it's worth, and a pretty bad perf hit. Let's close this!