macro_rules! pref_enum {
($(#[$meta:meta])* $vis:vis enum $name:ident { $($(#[$vmeta:meta])* $variant:ident = $tag:literal),+ $(,)? }) => { ... };
}Expand description
Declare an enum that round-trips through the store under short stable tags:
ⓘ
pref_enum! {
/// Temperature unit.
pub enum Unit { Celsius = "c", Fahrenheit = "f" }
}The enum derives Clone, Copy, PartialEq, Eq, Debug, implements PrefValue, and gets
a const ALL: &[Self] in declaration order (what a a choice row iterates).