icu_locale_core/preferences/extensions/unicode/keywords/
dictionary_break.rs1#[cfg(feature = "alloc")]
6use crate::extensions::unicode::Value;
7#[cfg(feature = "alloc")]
8use crate::preferences::extensions::unicode::errors::PreferencesParseError;
9#[cfg(feature = "alloc")]
10use crate::preferences::extensions::unicode::struct_keyword;
11#[cfg(feature = "alloc")]
12use crate::subtags::Script;
13#[cfg(feature = "alloc")]
14use alloc::vec::Vec;
15#[cfg(feature = "alloc")]
16use core::str::FromStr;
17
18#[cfg(feature = "alloc")]
19struct_keyword!(
20 DictionaryBreakScriptExclusions,
25 "dx",
26 Vec<Script>,
27 |input: Value| {
28 input
29 .into_iter()
30 .map(|s| {
31 Script::from_str(s.as_str()).map_err(|_| PreferencesParseError::InvalidKeywordValue)
32 })
33 .collect::<Result<_, _>>()
34 .map(Self)
35 },
36 |input: DictionaryBreakScriptExclusions| {
37 input.0.into_iter().map(Into::into).collect()
38 }
39);