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

Implement (behind a feature branch) the Merge Crate

RuboGubo opened this issue · comments

I need this crate derive for my project, and thought I would quickly drop by to write the issue and try to implement it. I don't see any reason why you would not do this, as it can all be hidden behind a feature flag for the people that don't need it.

What would you want implemented here? There's no universal merge strategy to choose, so you will need to apply your own choice that makes sense in your own domain. At a glance, I don't think indexmap needs to do anything for that.

I have made by best attempt at implementing it, feel free to tell me what you think, I think what I settled on makes sense though.

I think what I settled on makes sense though.

My point is that the merge crate doesn't even try to decide that for any standard library containers. They could have implemented for Vec or HashMap, either of which would have been useful precedent here, but instead their absence is precedent that there's no one right answer for a container.

Let's leave it up to each user how they should be merged.