Skip to content

Implement FromAbbrevStr procedural derive macro? #61

@JackKelly

Description

@JackKelly

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions