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

Implement FromAbbrevStr procedural derive macro? #61

Open
JackKelly opened this issue Oct 1, 2024 · 1 comment · May be fixed by #62
Open

Implement FromAbbrevStr procedural derive macro? #61

JackKelly opened this issue Oct 1, 2024 · 1 comment · May be fixed by #62

Comments

@JackKelly
Copy link
Contributor

JackKelly commented Oct 1, 2024

Following on from #41 (comment)

Maybe one way to easily map from abbrev strings to a parameter enum variant is that I could try to implement a FromAbbrevStr procedural derive macro. This macro would implement the FromStr trait. And then I could add #[derive(FromAbbrevStr)] to every enum in gribberish::templates::product::parameters::*. Does that sounds like a good way to go?

For example, calling TemperatureProduct::from_str("TMP") would return TemperatureProduct::Temperature.

@JackKelly JackKelly changed the title Implement a FromAbbrev procedural derive macro? Implement a FromAbbrevStr procedural derive macro? Oct 3, 2024
@JackKelly JackKelly linked a pull request Oct 3, 2024 that will close this issue
@JackKelly JackKelly changed the title Implement a FromAbbrevStr procedural derive macro? Implement FromAbbrevStr procedural derive macro? Oct 3, 2024
@JackKelly
Copy link
Contributor Author

An attempt to implement a FromAbbrevStr proc derive macro is now in PR #62 🙂

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 a pull request may close this issue.

1 participant