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

Serialize enumeration as index #319

Open
woodworker7 opened this issue Oct 21, 2022 · 2 comments
Open

Serialize enumeration as index #319

woodworker7 opened this issue Oct 21, 2022 · 2 comments

Comments

@woodworker7
Copy link

Hello,

I noticed that between versions 0.15.4 and 1.0.0 the enumerations are serialized by name rather than index.

Is it possible by configuration to achieve back the old behavior?

@Zannick
Copy link

Zannick commented May 16, 2023

Seconding this. I have a need for an efficient binary packing of data (ideally without renaming my enum fields from descriptive names to single-character names), which msgpack is great at for all other datatypes. I was able to use #[repr(uX)] for all of my C-like enums but that is a feature of serde_repr.

It would be nice to have a similar explicit configuration on the enum to use a tag index or manually tag each enum variant with an integer tag.

@kornelski
Copy link
Collaborator

Dupe #327

The change wasn't intentional. I'm not sure whether that was a side effect of fixing nested Option serialization, or just an accident. The format was meant to be configurable.

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

No branches or pull requests

3 participants