]> git.proxmox.com Git - rustc.git/blob - vendor/icu_locid/src/extensions/unicode/attribute.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / vendor / icu_locid / src / extensions / unicode / attribute.rs
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 impl_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;
16 /// use icu::locid::extensions_unicode_attribute as attribute;
17 ///
18 /// let attr: Attribute =
19 /// "buddhist".parse().expect("Failed to parse an Attribute.");
20 ///
21 /// assert_eq!(attr, attribute!("buddhist"));
22 /// ```
23 Attribute,
24 extensions::unicode::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 );