macro_rules! impl_enum_data {
($name:ident = $value:expr $(, $from:literal => $to:literal)* $(,)?) => { ... };
}Expand description
A macro for implementing data-like (states, payload) for an enum.
Usage is impl_struct_data! { EnumName = default value, "from" => "to", ... }
to implement all the boilerplate for an enum named EnumName, providing it with
a default value and displaying it using the results of Debug patched by replacing
each of the (optional) "from" string(s) with its matching "to" string.
The enum type needs to #[derive(PartialEq, Eq, Hash, Copy, Clone, Debug, strum::IntoStaticStr)]. The variant name will be used as the short name for the state (e.g. in
condensed diagrams). Additional fields would be used to carry detailed state data.