]>
git.proxmox.com Git - rustc.git/blob - vendor/icu_locid/src/extensions/unicode/key.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 ).
6 /// A key used in a list of [`Keywords`](super::Keywords).
8 /// The key has to be a two ASCII alphanumerical characters long, with the first
9 /// character being alphanumeric, and the second being alphabetic.
15 /// use icu::locid::extensions::unicode::Key;
17 /// assert!("ca".parse::<Key>().is_ok());
20 extensions
::unicode
::Key
,
21 extensions_unicode_key
,
24 s
.all_bytes()[0].is_ascii_alphanumeric() && s
.all_bytes()[1].is_ascii_alphabetic(),
25 s
.to_ascii_lowercase(),
26 (s
.all_bytes()[0].is_ascii_lowercase() || s
.all_bytes()[0].is_ascii_digit())
27 && s
.all_bytes()[1].is_ascii_lowercase(),