macro_rules! impl_struct_data {
($name:ident = $value:expr $(, $from:literal => $to:literal)* $(,)?) => { ... };
}Expand description
A macro for implementing data-like (states, payload) for a struct with a name field.
Usage is impl_struct_data! { StructName = default value, "from" => "to", ... }
to implement all the boilerplate for a struct named StructName, 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 struct type needs to #[derive(PartialEq, Eq, Hash, Copy, Clone, Debug)]. It needs to
have a name field which is a simple enum using The struct type needs to
#[derive(PartialEq, Eq, Hash, Copy, Clone, Debug, strum::IntoStaticStr)], which is used as
the short name for the state (e.g. in condensed diagrams). Additional fields would be used to
carry detailed state data.