#[derive(EnumDeserialize)]
{
// Attributes available to this derive:
#[enumscribe]
}
Expand description
Derives serde::Deserialize for an enum.
The enum will be deserialized from a string. If the input was not a valid string, an error
will be returned. You can specify what string should map to a particular variant by using
#[enumscribe(str = "foo")], just like the other derive macros in this crate. You can also
use #[enumscribe(case_insensitive)] to use case-insensitive matching for a variant, like
Unscribe and TryUnscribe.
Also like Unscribe, you can annotate a variant with
#[enumscribe(other)]. If included, the other variant will be used to store strings that
could not be matched to any other variant. The other variant should have a single field,
which should have type String. If an other variant is not included, an error will be
returned when a string could not be matched to any variant.
This derive also allows you to use #[enumscribe(ignore)]. No string will ever deserialize
to an ignored variant.