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

Add derive support for simple enums. #14

Merged
merged 1 commit into from
Aug 25, 2019
Merged

Conversation

theduke
Copy link
Contributor

@theduke theduke commented Aug 22, 2019

Only simple C-style enums are accepted.
Enums with fields, generics or where clauses are rejected.
The #[serde(rename)] attribute is respected.

Closes #12 .

As requested, the https://github.com/theduke/miniserde/tree/enum-benchmarks branch contains a little benchmark setup in the mini-bench directory, which is compiling 500 structs with 500 enums contained in those structs , and serializes them.

cd mini-bench; time $(cargo clean && cargo build --release --features=mini) && time $(cargo clean && cargo build --release --features=full)

The result is pretty conclusive. ;)

Miniserde: 31s
serde: 2m04s

@theduke theduke force-pushed the enums branch 2 times, most recently from 7e378f7 to 3d52d5d Compare August 22, 2019 10:10
Add (De)Serialize support for simple enums.

Only simple C-style enums are accepted.
Enums with fields, generics or where clauses are rejected.
The #[serde(rename)] attribute is respected.
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

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

Thanks!

@dtolnay dtolnay merged commit c0b30c7 into dtolnay:master Aug 25, 2019
@dtolnay
Copy link
Owner

dtolnay commented Aug 25, 2019

Published in 0.1.12.

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.

Consider C-style Enum support
2 participants