tafia / quick-protobuf

A rust implementation of protobuf parser
MIT License
446 stars 82 forks source link

[Feature request] pb-rs deterministic mode #251

Open chenxiaolong opened 1 year ago

chenxiaolong commented 1 year ago

Would it be possible to add a feature to pb-rs so that the generated code only uses containers with deterministic iteration order? In my testing, it appears the only thing preventing the serialized protobuf messages from being deterministic in the default configuration is the usage of HashMap. I've been using .nostd(true) as a workaround to make the generated code use BTreeMap (sorted iteration order), but it would be nice to have something explicit for this and not rely on an implementation detail.

Thanks!