frozenlib / parse-display

Procedural macro to implement Display and FromStr using common settings.
Apache License 2.0
182 stars 14 forks source link

Allow ignoring enum variants from "from_str" #25

Closed norcalli closed 2 years ago

norcalli commented 2 years ago

Sometimes it is desirable to not necessarily have complete symmetry in whether something can be constructed from a string even though it can be printed.

#[from_str(ignore)] on a variant would be basically what I'd want.

To be clear, the difference from current functionality is that the variant doesn't need to have default or anything in order to work.

frozenlib commented 2 years ago

Good idea.

I just implemented it with ee521d821390f27bd92dbd89d1bc79a5b29c0aa8.