| 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 | /// A single item used in a list of [`Private`](super::Private) extensions. |
| 7 | /// |
| 8 | /// The subtag has to be an ASCII alphanumerical string no shorter than |
| 9 | /// one character and no longer than eight. |
| 10 | /// |
| 11 | /// # Examples |
| 12 | /// |
| 13 | /// ``` |
| 14 | /// use icu::locid::extensions::private::Subtag; |
| 15 | /// |
| 16 | /// let subtag1: Subtag = "Foo".parse().expect("Failed to parse a Subtag."); |
| 17 | /// |
| 18 | /// assert_eq!(subtag1.as_str(), "foo"); |
| 19 | /// ``` |
| 20 | Subtag, |
| 21 | extensions::private, |
| 22 | subtag, |
| 23 | extensions_private_subtag, |
| 24 | 1..=8, |
| 25 | s, |
| 26 | s.is_ascii_alphanumeric(), |
| 27 | s.to_ascii_lowercase(), |
| 28 | s.is_ascii_alphanumeric() && s.is_ascii_lowercase(), |
| 29 | InvalidExtension, |
| 30 | ["foo12" ], |
| 31 | ["toolooong" ], |
| 32 | ); |
| 33 | |