Adds FromStr and TryFrom<&str> traits to enums implementations#1637
Open
xanathar wants to merge 1 commit intogtk-rs:mainfrom
Open
Adds FromStr and TryFrom<&str> traits to enums implementations#1637xanathar wants to merge 1 commit intogtk-rs:mainfrom
xanathar wants to merge 1 commit intogtk-rs:mainfrom
Conversation
Member
|
Can you do a patch for gtk-rs-core/gtk4-rs already so we can see if the changes looks good and work? |
Contributor
Author
|
Of course, just give me a few days. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the generation of
FromStrandTryFrom<&str>trait impls for enums.doc(hidden)attribute so that the traits get documented by cargo docBoolErrorThis does not use a configuration parameter. After implementing it, I'm leaning on the opinion that a configuration flag should be provided, as it's not entirely unlikely for somebody to have implemented FromStr or TryFrom in their
/manual/module, and if that implementation does not use the same nicks it can be a little painful to migrate.Not part of this PR
These are not in the PR, might be desired in future PRs:
impl Display for $enumfor the reverse operationgtk-rs-core
Tested gtk-core-rs with this and it seems to work. Also a couple of personal projects build just fine.
If/when this gets merged, I can follow-up with a PR on gtk-rs-core.