macro_rules! enum_keyword {
    (
        $(#[$doc:meta])*
        $([$derive_attrs:ty])?
        $name:ident {
            $(
                $(#[$variant_doc:meta])*
                $([$variant_attr:ty])?
                $variant:ident $($v2:ident)?
            ),*
        }
    ) => { ... };
    ($(#[$doc:meta])* $([$derive_attrs:ty])? $name:ident {
        $(
            $(#[$variant_doc:meta])*
            $([$variant_attr:ty])?
            ($key:expr => $variant:ident $(($v2:ident) {
                $(
                    ($subk:expr => $subv:ident)
                ),*
            })?)
        ),* $(,)?
    }, $ext_key:literal) => { ... };
}
Expand description

Macro used to generate a preference keyword as an enum.

The macro supports single and two subtag enums.

§Examples

use icu::locale::preferences::extensions::unicode::enum_keyword;

enum_keyword!(
    EmojiPresentationStyle {
        ("emoji" => Emoji),
        ("text" => Text),
        ("default" => Default)
}, "em");

enum_keyword!(
     MetaKeyword {
        ("normal" => Normal),
        ("emoji" => Emoji(EmojiPresentationStyle) {
            ("emoji" => Emoji),
            ("text" => Text),
            ("default" => Default)
        })
}, "mk");