serde_variant
So you have just carefully defined your enum to be serialized and
deserialized using serde as you intended and now you need an
additional FromStr or Display implementation that uses the same
names for enum variants as serde uses? You are reluctant to
duplicate all those definitions in two places?
serde_variant is a crate that allows you to retrieve back the
identifier of any enum variant passed to it.
Usage
The crate provides a single function, to_variant_name, that retrieves
the name of a passed in enum variant. For example:
use to_variant_name;
assert_eq!;
assert_eq!;