multi-map icon indicating copy to clipboard operation
multi-map copied to clipboard

Implement the whole HashMap interface

Open hmuendel opened this issue 4 years ago • 3 comments

First of all, thank you very much for the quick responses and gentle guidance. I also stumbled over the missing len() method, which I implemented for myself in my fork. A lot of these methods are very easy to pass through from the underlying HashMap. Here is a list of all methods missing compared with HashMap.

Methods

Trait Implementations

Blanket Implementations

If you have no objections, I would try to implement some of the these, in the coming weeks and create PRs as soon as I accumulated a meaningful contribution. If someone else is working on it, we could check the boxes, to avoid duplicate work

hmuendel avatar Apr 19 '20 08:04 hmuendel

I just bumped into not having clear() which was a little disappointing (though I was able to work around it with mem::replace).

Rather than tackling all of these, maybe it's best to attempt the low-hanging fruit first? I'd probably avoid naively implementing with_hasher because you may want to use different hashers for each underlying HashMap, but things like values_mut should be relatively straightforward. I'd like to PR some of these in, if this project is still maintained.

jeff-hiner avatar Jan 29 '21 18:01 jeff-hiner

That sounds good to me @jeff-hiner :)

eldruin avatar Jan 30 '21 15:01 eldruin

I implement almost whole list of requests, but there are some difficulties with naming of functions.

It is very difficult to remember that methods with "alt" it is methods with key 2, and without "alt" it's methods with key 1. And also these all methods names have different length, mismatched and not symmetrical.

Can we change the existing API? Renaming methods with suffix "key1", "key2" or "keys"? For example with changing the version of crate to 2.0.

JustForFun88 avatar Mar 20 '22 13:03 JustForFun88