Open mitsuhiko opened 5 years ago
Thanks for the PR! I'm open to including this, but do have a few points that need addressing:
PartialEq
to match Hash
and Ord
here, otherwise it will use indexmap's implementation, which apparently does not preserve ordering. (The next point invalidates the need for this though.)::map
module with a newtype that can be used regardless of the MapImpl
chosen.
@arcnmx a lot of the serde ecosystem completely breaks sadly by turning on features. For instance serde-json's arbitrary_precision
support completely breaks one of our projects. Given that this is how the ecosystem works at the moment I'm not super concerned about turning on this feature here having worse repercussions.
I think this breakage is worse than what happens around arbitrary_precision. It would be better to solve this the way @arcnmx asked, using an opaque map type like how serde_json's preserve_order works.
Separately, are there use cases that require this to be a map at all? Otherwise Vec<(Value, Value)>
could be a more appropriate underlying type.
That's a good point - or alternatively, would it be appropriate to make indexmap the only option if the overhead is comparable?
This adds support for the
preserve_order
feature that is also provided byserde_json
. The behavior is similar and comes with the same general downsides that it's a global feature.