Macro icu_locale_core::preferences::extensions::unicode::struct_keyword
source · macro_rules! struct_keyword { ($(#[$doc:meta])* $([$derive_attrs:ty])? $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::{
extensions::unicode::{Key, Value},
preferences::extensions::unicode::struct_keyword,
};
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()
}
);