#345 introduces a trait called SelectChoice which is essentially an enum that allows converting between a no-data enum and its string representation (see the conversation for more context: #345 (comment)).
Because it's fairly trivial to provide implementation of this trait for an enum, this makes it a perfect candidate for creating a derive macro. In fact, this functionality is also essentially what the strum crate is doing.
We should investigate whether it is possible and makes sense to use strum for this, or if not, just implement the derive macro ourselves (which shouldn't be too difficult). Note that we need some way both to override the string representation of an enum variant (id() method), and the human-friendly string displayed to the users (to_string()).
#345 introduces a trait called
SelectChoicewhich is essentially an enum that allows converting between a no-data enum and its string representation (see the conversation for more context: #345 (comment)).Because it's fairly trivial to provide implementation of this trait for an enum, this makes it a perfect candidate for creating a derive macro. In fact, this functionality is also essentially what the
strumcrate is doing.We should investigate whether it is possible and makes sense to use strum for this, or if not, just implement the derive macro ourselves (which shouldn't be too difficult). Note that we need some way both to override the string representation of an enum variant (
id()method), and the human-friendly string displayed to the users (to_string()).