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 #700

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

akhramov
Copy link

@akhramov akhramov commented Jan 8, 2024

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.

This change

@akhramov
Copy link
Author

akhramov commented Jan 8, 2024

(reopened #696, sorry for the noise)

@akhramov akhramov marked this pull request as ready for review January 8, 2024 15:02
@stepancheg
Copy link
Owner

I think changes in .github/workflows/ci.yml should be reverted.

@stepancheg
Copy link
Owner

Also we don't need a separate crate for test. Instead, code should be customized for single test file within test suite.

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.

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
Copy link
Author

I think changes in .github/workflows/ci.yml should be reverted.

Absolutely.

Also we don't need a separate crate for test. Instead, code should be customized for single test file within test suite.

Not sure if I got you right, wdyt of the current approach?

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.

None yet

2 participants