Macro icu_properties::props::create_const_array

source ·
macro_rules! create_const_array {
    (
        $ ( #[$meta:meta] )*
        impl $enum_ty:ident {
            $( $(#[$const_meta:meta])* $v:vis const $i:ident: $t:ty = $e:expr; )*
        }
    ) => { ... };
}
Expand description

See [test_enumerated_property_completeness] for usage. Example input:

impl EastAsianWidth {
    pub const Neutral: EastAsianWidth = EastAsianWidth(0);
    pub const Ambiguous: EastAsianWidth = EastAsianWidth(1);
    ...
}

Produces const ALL_CONSTS = &[("Neutral", 0u16), ...]; by explicitly casting first field of the struct to u16.