#[non_exhaustive]pub enum KeyNormalisation {
NoRule,
UpperAscii,
NfcStrict,
ArabicSkeleton,
HebrewConsonantal,
GreekUnaccented,
LabelFold,
}Expand description
One rule of the closed list of 16.4. The list grows only through revisions of the
specification, so the enum is #[non_exhaustive].
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoRule
none: any string (3.5). Named NoRule so that it is not mistaken for Option::None.
UpperAscii
upper_ascii: printable ASCII only (U+0021 to U+007E), no lowercase a-z.
NfcStrict
nfc_strict: no format character (Cf), no White_Space character (Unicode 15.1) other than
U+0020, and no leading, trailing or repeated U+0020. The White_Space characters that 3.5
does not already refuse are U+00A0, U+1680, U+2002-U+200A, U+2028, U+2029, U+202F, U+205F
and U+3000 (U+0009-U+000D and U+0085 are controls; U+2000 and U+2001 are not NFC).
ArabicSkeleton
arabic_skeleton: no Arabic mark (U+0610-U+061A, U+064B-U+065F, U+0670, U+06D6-U+06DC,
U+06DF-U+06E8, U+06EA-U+06ED) and no tatweel U+0640.
HebrewConsonantal
hebrew_consonantal: no Hebrew point or accent U+0591-U+05C7 except maqaf U+05BE, paseq
U+05C0, sof pasuq U+05C3 and nun hafukha U+05C6.
GreekUnaccented
greek_unaccented: no combining mark U+0300-U+036F in the NFD form.
LabelFold
label_fold (16.4, the classes round): a value is canonical when it equals its own
fold_label: full case folding, NFC, each run of White_Space one U+0020, no leading or trailing
space, and not empty. A label is the only thing it is for: a key is never folded, and a request’s
label is repaired to its folding by the mesh (16.1).
Implementations§
Source§impl KeyNormalisation
impl KeyNormalisation
Sourcepub const ALL: &'static [KeyNormalisation]
pub const ALL: &'static [KeyNormalisation]
Every rule, in the order of the table of 16.4.
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
The rule as written in a descriptor: none, upper_ascii, nfc_strict,
arabic_skeleton, hebrew_consonantal, greek_unaccented.
Sourcepub fn from_name(text: &str) -> Option<KeyNormalisation>
pub fn from_name(text: &str) -> Option<KeyNormalisation>
Looks a rule up by its text (exact, lowercase); None for anything not in the list.
Sourcepub fn check(self, text: &str) -> Result<()>
pub fn check(self, text: &str) -> Result<()>
Checks that text is canonical under this rule (16.4): a pure function. The text is first
a string value by 3.5 under every rule, with 3.5’s codes (E_CANON_STRING, E_CANON_LIMIT,
never E_KEY_NORMALISATION). Then the rule: none accepts what 3.5 accepts, the empty
string included; every other rule rejects the empty string, and a value the rule forbids
is E_KEY_NORMALISATION, never repaired.