-
Notifications
You must be signed in to change notification settings - Fork 317
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Feature request: into_group_btreemap #520
Comments
Hi, nice idea. It appears there is a certain need for this, as the request for other containers comes up (in different flavors) from time to time:
I'd like to put on the record (see #462 (comment)) that imho in an ideal world we would solve this problem by abstracting over the kind of the container -- leading to uniform support for It might not be easily doable, but I am unsure if duplicating functions here and there is better than exploring the possibilities of the aforementioned abstraction. |
Hey 👋🏻 Any updates on this? |
I did not see any update related to it. The only recent thing is me adding the label "generic-container". |
While duplicating methods isn't great, they could later be changed to aliases of the generic method. Having a second implementation should also serve as a good example use case for actually writing the generic. Are there other containers that would benefit from the same? |
I've just found myself looking for this, would be a nice addition |
This is sorely missing feature. Default rust HashMap is rarely what's wanted as a result due to slow default hash function... |
@Philippe-Cholet Should we, as a first step, tackle this by offering |
@phimuemue I think that's a great idea. I've created a tracking issue: #998 |
A
BTreeMap
version of theinto_group*
function group would be a nice addition.The idea is that sometimes working with
Hash
is not feasible or even impossible, e.g. when you have to work with float-based datatypes as key or you would like to group your data by some custom criteria without wrapping the type and implementing customHash
.The
into_group_btreemap()
andinto_group_btreemap_by()
functions should work similarly howinto_group_map()
andinto_group_btreemap_by()
work, but would requireK: Ord + Eq
instead ofK: Hash + Eq
and would returnBTreeMap<K, Vec<V>>
instead ofHashMap<K, Vec<V>>
.I have the code patched into my codebase, so I can also start a PR is this feature is required.
The text was updated successfully, but these errors were encountered: