Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Variant data type support #170
Variant data type support #170
Changes from 3 commits
b6053ec
352c6d5
5b3ad2c
176bc28
325a08c
f08fc5f
0290d97
53f52e2
a8625ad
a1a1c20
877c5b6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be an error on the definition side (
SomeEnum::A
without any payload), innit?We should return an error here to avoid the generic "not enough data" error. Probably, it's time to introduce
Error::Unsupported
instead of panics, but up to you here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
Error::Unsupported
and used it in this case. The rest of the panics can be changed as a follow-up.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this code implicitly allows using enums at the top level. Usually, it's avoided by using either the parameter stored in the serializer struct or dedicated
SerializeStruct
/etc associated types.In general, it's okay (the user will get some error anyway), but instead of more descriptive panic, it ends with "not enough data."
Also, it produces an unclear message for forgotten
serde_repr
(Enum8
andEnum16
).It's not a blocker for merge because it's an error anyway. But, probably, we should leave "TODO" at least in the code about it.