indexmap-rs / indexmap

A hash table with consistent order and fast iteration; access items by key or sequence index

Home Page:https://docs.rs/indexmap/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Provide two implementations: `HashIndexMap` and `BTreeIndexMap`.

timothee-haudebourg opened this issue · comments

Adding a BTreeIndexMap has some nice benefits like the Hash, PartialOrd and Ord implementations. I think it would be a great addition to this library as it would even more mirror the standard library. I considered creating a dedicated library for this data-structure, but I think it would fit in here.

I think that could be interesting, but it would require a significantly different implementation, so I don't think it would be worth keeping in the same crate.

We used to have a bespoke hash-table implementation in indexmap, and later switched to hashbrown::raw::RawTable since that still allowed us to use our custom way of hashing/lookup/etc. There's nothing like that for a custom BTreeMap that I'm aware of, and the standard library code is sufficiently complex (and unsafe) that I personally would not be eager to duplicate that with modifications.

If you think it's easier than I imagine, please explain, otherwise I think you should go ahead with an independent crate.