You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A BTreeMap version of the into_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 custom Hash.
The into_group_btreemap() and into_group_btreemap_by() functions should work similarly how into_group_map() and into_group_btreemap_by() work, but would require K: Ord + Eq instead of K: Hash + Eq and would return BTreeMap<K, Vec<V>> instead of HashMap<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:
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 HashMaps, BTreeMaps, sorted Vecs, EnumMap<Enum, Option<_>>, and possibly more, instead of having sporadic support for some of them.
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.
I did not see any update related to it. The only recent thing is me adding the label "generic-container".
Personally, I tried some approaches to have more generic containers but nothing satisfying yet (by far).
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: