Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codegen: option to use BTreeMap as map representation #696

Closed
wants to merge 1 commit into from
Closed

Codegen: option to use BTreeMap as map representation #696

wants to merge 1 commit into from

Conversation

akhramov
Copy link
Contributor

As of now, protobuf maps are represented with
std::collections::HashMap, which serves as a robust default. In rarer instances, opting for a different implementation, such as BTreeMap, might be desirable, e.g. for deterministic serialization (#496).

This change

As of now, protobuf maps are represented with
[std::collections::HashMap](https://doc.rust-lang.org/stable/std/collections/struct.HashMap.html),
which serves as a robust default. In rarer instances, opting for a
different implementation, such as BTreeMap, might be desirable,
e.g. for deterministic serialization (#496).

This change

* adds `btreemaps` codegen option to generate
  [std::collections::BTreeMap](https://doc.rust-lang.org/std/collections/struct.BTreeMap.html)
  for maps representation.
@akhramov akhramov marked this pull request as ready for review December 22, 2023 08:30
@@ -1,4 +1,7 @@
use std::collections::HashMap;
#[cfg(feature = "test_with_btreemaps")]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_with_btreemaps is enabled by btreemap tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant