Macro icu_locale_core::preferences::extensions::unicode::struct_keyword
source · macro_rules! struct_keyword { ($(#[$doc:meta])* $name:ident, $ext_key:literal, $value:ty, $try_from:expr, $into:expr) => { ... }; }
Expand description
Macro used to generate a preference keyword as a struct.
§Examples
use icu::locale::{
preferences::extensions::unicode::struct_keyword,
extensions::unicode::{Key, Value},
};
struct_keyword!(
CurrencyType,
"cu",
String,
|input: Value| {
Ok(Self(input.to_string()))
},
|input: CurrencyType| {
icu::locale::extensions::unicode::Value::try_from_str(input.0.as_str()).unwrap()
}
);