Open jon-zu opened 6 months ago
Perhaps a generic "specify Map type" kind of setting? Some folks would prefer BTreeMap
to HashMap
so it might be nice to just allow this to be specified generically. I suppose we could do this for arrays and sets as well.
A special map type via settings is also a good choice, however It's somewhat convenient (can be also confusing ofc) that serde_json::Map
is controlled over the feature flag in the Cargo.toml
. So maybe allowing 3 options(Default, serde_json or custom) would be a decent setting. I can try to get a cli option working for this next week and make a pull request.
I'd welcome a pull request here. My suggestion is to provide an option for all modes (builder, macro, CLI) that lets you specify the fully qualified path of the map type you'd like. The assumption would be that it would be a type of the form T<K,V>
that supports typical map-like operations (it would be nice in the docs if we specify what those map-like operations are specifically).
Sometimes It's required to preserve the order, If we could add a flag to generate code with
IndexMap
instead ofHashMap
. We could also just utilizeserde_json::Map
so It'd respect theserde_json
feature flag.