Derive Macro enumscribe::EnumSerialize
source · #[derive(EnumSerialize)]
{
// Attributes available to this derive:
#[enumscribe]
}
Expand description
Derives serde::Serialize for an enum.
The enum will be serialized to a string. You can specify what string should be used to
represent a particular variant by using #[enumscribe(str = "foo")], just like the other
derive macros in this crate.
This derive also allows you to use #[enumscribe(other)] and #[enumscribe(ignore)].
Trying to serialize an ignored variant will result in an error being returned. Serializing
an other variant will simply use whatever the value of its field is.