Adds FromStr and TryFrom<&str> traits to enums implementations #1637
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.