We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Would be great if the following use-case of embedding enums would be supported:
#[derive(Clone, Debug, PartialEq, cbor::Encode, cbor::Decode)] pub enum B { #[cbor(rename="b_variant")] BVariant, #[cbor(rename="b_variant2")] BVariant2, } #[derive(Clone, Debug, PartialEq, cbor::Encode, cbor::Decode)] pub enum A { #[cbor(rename="a_variant")] AVariant, #[cbor(embed)] Embed(B), }
Where A would result in a "merged/flattened" enum being able to deserialize serialied B enums.
A
B
Current workaround requires manually "embedding" B enum vairants into A:
#[derive(Clone, Debug, PartialEq, cbor::Encode, cbor::Decode)] pub enum A { #[cbor(rename="a_variant")] AVariant, #[cbor(rename="b_variant")] BVariant, #[cbor(rename="b_variant2")] BVariant2, }
Related serde issue:
The text was updated successfully, but these errors were encountered:
kostko
Successfully merging a pull request may close this issue.
Would be great if the following use-case of embedding enums would be supported:
Where
A
would result in a "merged/flattened" enum being able to deserialize serialiedB
enums.Current workaround requires manually "embedding"
B
enum vairants intoA
:Related serde issue:
The text was updated successfully, but these errors were encountered: