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
5impl_tinystr_subtag!(
6 /// An attribute used in a set of [`Attributes`](super::Attributes).
7 ///
8 /// An attribute has to be a sequence of alphanumerical characters no
9 /// shorter than three and no longer than eight characters.
10 ///
11 ///
12 /// # Examples
13 ///
14 /// ```
15 /// use icu::locid::extensions::unicode::{attribute, Attribute};
16 ///
17 /// let attr: Attribute =
18 /// "buddhist".parse().expect("Failed to parse an Attribute.");
19 ///
20 /// assert_eq!(attr, attribute!("buddhist"));
21 /// ```
22 Attribute,
23 extensions::unicode,
24 attribute,
25 extensions_unicode_attribute,
26 3..=8,
27 s,
28 s.is_ascii_alphanumeric(),
29 s.to_ascii_lowercase(),
30 s.is_ascii_alphanumeric() && s.is_ascii_lowercase(),
31 InvalidExtension,
32 ["foo12"],
33 ["no", "toolooong"],
34);
35