pub trait UnicodeCaseFold<I: Iterator<Item = char>>: Sized {
// Required method
fn case_fold_with(self, _: Variant, _: Locale) -> CaseFold<I> ⓘ;
// Provided method
fn case_fold(self) -> CaseFold<I> ⓘ { ... }
}
Expand description
Methods for case folding text.
Required Methods§
Sourcefn case_fold_with(self, _: Variant, _: Locale) -> CaseFold<I> ⓘ
fn case_fold_with(self, _: Variant, _: Locale) -> CaseFold<I> ⓘ
Returns an iterator over the case folded characters of self
.
§Parameters
The Variant
can be either:
-
Variant::Full
(recommended), which may expand to a longer string. For example, the full case folded version ofß
(one character) isss
(two characters). -
Variant::Simple
, a simpler variant which always expands to a string with the same number of characters. This is more efficient, but less complete.
The Locale
can be either:
-
Locale::NonTurkic
(default), which mapsI
toi
. -
Locale::Turkic
, which mapsI
toı
(dotless i), as is the case in Turkic languages.
§Examples
let name = "Inigo Montoya";
let turkic = name.case_fold_with(Variant::Full, Locale::Turkic).collect::<String>();
let non_turkic = name.case_fold_with(Variant::Full, Locale::NonTurkic).collect::<String>();
assert_eq!(turkic, "ınigo montoya"); // note the dotless i
assert_eq!(non_turkic, "inigo montoya");
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.