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

Fix (de)serialization of transferable outputs #181

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

4tXJ7f
Copy link

@4tXJ7f 4tXJ7f commented Mar 31, 2024

This fixes the (de)serialization of tranferable outputs by refactoring outputs to be represented by an enum instead of two Option fields. This refactoring has several advantages:

  • Allows the use of #[serde(untagged)] for (de)serializing outputs
  • Makes it explicit that one of the two output types has to be present (before, deserialization could succeed if the output field could not be parsed)
  • Simplifies code that handles outputs

This change also removes some of the code repetition

This fixes the (de)serialization of tranferable outputs by refactoring outputs
to be represented by an enum instead of two `Option` fields. This refactoring
has several advantages:

- Allows the use of `#[serde(untagged)]` for (de)serializing outputs
- Makes it explicit that one of the two output types has to be present (before,
  deserialization could succeed if the output field could not be parsed)
- Simplifies code that handles outputs

This change also removes some of the code repetition
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.

1 participant