Open Stefanuk12 opened 1 year ago
@Stefanuk12, that's an interesting case. Would your case be solved if we supressed the warning and/or didn't emit the branch if it was a duplicate? The balance I'm trying to hit is that the FromStr macro generates dead simple code, and should, IMO, have a very simple configuration associated with it so I'm trying to avoid adding too many flags.
The idea is a one way conversion. Ideally, don't emit the branch associated with to_string, if serialize is also specified on the same variant. If you're not able to, don't worry about it - there's probably a better way of me doing this anyway.
This behaviour is intentional but an option to disable
to_string
being included within theFromStr
implementation would be nice.Example code
In the following code, each url maps to a key. While a function could be used to map between the two, I prefer this method as the enum can provide additional information.
produces the following impl