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

Enum primitives and empty enum variants #2

Merged
merged 8 commits into from Apr 6, 2022

Conversation

ozgb
Copy link
Contributor

@ozgb ozgb commented Apr 1, 2022

This allows an enum represented in Rust:

enum MyEnum {
    One,
    Two(u32),
    Three(i16),
}

to be serialized/deserialized using:

type MyEnum struct {
	Enum BorshEnum `borsh_enum:"true"`
	One EmptyVariant
	Two uint32
	Three int16
}

borsh_test.go Outdated Show resolved Hide resolved
borsh_test.go Outdated Show resolved Hide resolved
encoder_borsh.go Outdated Show resolved Hide resolved
encoder_borsh.go Outdated Show resolved Hide resolved
encoder_borsh.go Outdated Show resolved Hide resolved
decoder_borsh.go Outdated Show resolved Hide resolved
decoder_borsh.go Outdated Show resolved Hide resolved
encoder_borsh.go Outdated Show resolved Hide resolved
@ozgb ozgb requested a review from gagliardetto April 4, 2022 13:02
@gagliardetto
Copy link
Owner

LGTM

@gagliardetto gagliardetto merged commit 65cc9d2 into gagliardetto:master Apr 6, 2022
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