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

feat(de): add EnumExt trait with deserialize_variant method #123

Merged
merged 1 commit into from
Jan 27, 2023

Conversation

mina86
Copy link
Contributor

@mina86 mina86 commented Jan 25, 2023

Introduce de::EnumExt trait with deserialize_variant method which
takes variant number as an argument rather than reading it from the
input.

This trait is derived for all enums which use BorshDeserialize derive.

It is useful when customer wants to perform some validation after the
variant is known but before the variant is fully deserialised.

@mina86 mina86 requested a review from frol as a code owner January 25, 2023 23:02
Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

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

@mina86 The change looks good to me, but the doctest fails in non-std context. Could you fix it?

Introduce de::EnumExt trait with deserialize_variant method which
takes variant number as an argument rather than reading it from the
input.

This trait is derived for all enums which use BorshDeserialize derive.

It is useful when customer wants to perform some validation after the
variant is known but before the variant is fully deserialised.
@mina86
Copy link
Contributor Author

mina86 commented Jan 26, 2023

done

@frol frol changed the title de: add EnumExt trait with deserialize_variant method feat(de): add EnumExt trait with deserialize_variant method Jan 27, 2023
@frol frol merged commit fdce5dc into near:master Jan 27, 2023
@frol
Copy link
Collaborator

frol commented Jan 27, 2023

@mina86 Thanks for the contribution!

@mina86 mina86 deleted the a branch January 27, 2023 17:23
@frol
Copy link
Collaborator

frol commented Feb 8, 2023

@mina86 FYI, borsh 0.10.1 release has this change.

This was referenced May 31, 2023
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.

None yet

2 participants