macro_rules! enum_keyword {
    (
        $(#[$doc:meta])*
        $name:ident {
            $(
                $(#[$variant_doc:meta])*
                $variant:ident $($v2:ident)?
            ),*
        }
    ) => { ... };
    ($(#[$doc:meta])* $name:ident {
        $(
            $(#[$variant_doc:meta])*
            ($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");