-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relax Ident constraint to allow all valid strings for argument values (…
…#39) Hey Yago! I've been using `enum_stringify` a lot lately for my 8086 decoder project. It saves me a lot of boilerplate code and prevents the need to write my own macro. Thank you! However, I came across a few limitations. If the argument value for `rename`, `prefix`, or `suffix` is not a valid identifier pattern, the macro panics, causing a compilation failure. For example, this causes a compilation failure: ```rust #[derive(enum_stringify::EnumStringify)] enum Separator { #[enum_stringify(rename = " ")] Space, #[enum_stringify(rename = "-")] Hyphen, #[enum_stringify(rename = "")] Empty, } ``` It appears that these argument values are constrained to fit the Ident pattern, which reduces flexibility by disallowing valid string literals. This PR addresses the issue. Please take a look and let me know what you think.
- Loading branch information
Showing
3 changed files
with
33 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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