• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // This file is part of ICU4X. For terms of use, please see the file
2 // called LICENSE at the top level of the ICU4X source tree
3 // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).
4 
5 use crate::preferences::extensions::unicode::errors::PreferencesParseError;
6 use crate::preferences::extensions::unicode::struct_keyword;
7 use crate::{extensions::unicode::Value, subtags::Subtag};
8 
9 struct_keyword!(
10     /// A Unicode Number System Identifier defines a type of number system.
11     ///
12     /// The valid values are listed in [LDML](https://unicode.org/reports/tr35/#UnicodeNumberSystemIdentifier).
13     [Copy]
14     NumberingSystem,
15     "nu",
16     Subtag,
17     |input: Value| {
18         input
19             .into_single_subtag()
20             .map(Self)
21             .ok_or(PreferencesParseError::InvalidKeywordValue)
22     },
23     |input: NumberingSystem| {
24         crate::extensions::unicode::Value::from_subtag(Some(input.0))
25     }
26 );
27