pub trait CharStringExt {
// Required methods
fn to_lower(&self) -> Cow<'_, [char]>;
fn normalized(&self) -> Cow<'_, [char]>;
fn to_string(&self) -> String;
fn eq_ignore_ascii_case_chars(&self, other: &[char]) -> bool;
fn eq_ignore_ascii_case_str(&self, other: &str) -> bool;
fn eq_any_ignore_ascii_case_chars(&self, others: &[&[char]]) -> bool;
fn ends_with_ignore_ascii_case_chars(&self, suffix: &[char]) -> bool;
fn ends_with_ignore_ascii_case_str(&self, suffix: &str) -> bool;
}
Expand description
Extensions to character sequences that make them easier to wrangle.
Required Methods§
Sourcefn to_lower(&self) -> Cow<'_, [char]>
fn to_lower(&self) -> Cow<'_, [char]>
Convert all characters to lowercase, returning a new owned vector if any changes were made.
Sourcefn normalized(&self) -> Cow<'_, [char]>
fn normalized(&self) -> Cow<'_, [char]>
Normalize the character sequence according to the dictionary’s standard character set.
Sourcefn eq_ignore_ascii_case_chars(&self, other: &[char]) -> bool
fn eq_ignore_ascii_case_chars(&self, other: &[char]) -> bool
Case-insensitive comparison with a character slice, assuming the right-hand side is lowercase ASCII. Only normalizes the left side to lowercase and avoids allocations.
Sourcefn eq_ignore_ascii_case_str(&self, other: &str) -> bool
fn eq_ignore_ascii_case_str(&self, other: &str) -> bool
Case-insensitive comparison with a string slice, assuming the right-hand side is lowercase ASCII. Only normalizes the left side to lowercase and avoids allocations.
Sourcefn eq_any_ignore_ascii_case_chars(&self, others: &[&[char]]) -> bool
fn eq_any_ignore_ascii_case_chars(&self, others: &[&[char]]) -> bool
Case-insensitive comparison with any of a list of character slices, assuming the right-hand side is lowercase ASCII. Only normalizes the left side to lowercase and avoids allocations.
Sourcefn ends_with_ignore_ascii_case_chars(&self, suffix: &[char]) -> bool
fn ends_with_ignore_ascii_case_chars(&self, suffix: &[char]) -> bool
Case-insensitive check if the string ends with the given ASCII suffix. The suffix is assumed to be lowercase.
Sourcefn ends_with_ignore_ascii_case_str(&self, suffix: &str) -> bool
fn ends_with_ignore_ascii_case_str(&self, suffix: &str) -> bool
Case-insensitive check if the string ends with the given ASCII suffix. The suffix is assumed to be lowercase.
Implementations on Foreign Types§
Source§impl CharStringExt for [char]
impl CharStringExt for [char]
Source§fn normalized(&self) -> Cow<'_, [char]>
fn normalized(&self) -> Cow<'_, [char]>
Convert a given character sequence to the standard character set the dictionary is in.