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

Add supports of conversion between string and enum #664

Closed
wants to merge 2 commits into from

Conversation

yestyle
Copy link
Contributor

@yestyle yestyle commented Jan 27, 2023

To support converting from &str to Enum and converting from Enum to String, add from_str() and implement Display for trait Enum respectively.

@stepancheg
Copy link
Owner

Merged with changes:

  • no Display (I'm not 100% sure it should be)
  • use string value directly without stringify! call
  • use proto enum name instead of rust name in match (probably it is the same everywhere, but safer this way)

Thanks!

@stepancheg stepancheg closed this Oct 2, 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