pub trait CharStringExt: Sealed {
Show 13 methods
// Required methods
fn to_lower(&self) -> Cow<'_, [char]>;
fn normalized(&self) -> Cow<'_, [char]>;
fn to_string(&self) -> String;
fn eq_ch(&self, other: &[char]) -> bool;
fn eq_str(&self, other: &str) -> bool;
fn eq_any_ignore_ascii_case_str(&self, others: &[&str]) -> bool;
fn eq_any_ignore_ascii_case_chars(&self, others: &[&[char]]) -> bool;
fn starts_with_ignore_ascii_case_str(&self, prefix: &str) -> bool;
fn starts_with_any_ignore_ascii_case_str(&self, prefixes: &[&str]) -> bool;
fn ends_with_ignore_ascii_case_chars(&self, suffix: &[char]) -> bool;
fn ends_with_ignore_ascii_case_str(&self, suffix: &str) -> bool;
fn ends_with_any_ignore_ascii_case_chars(
&self,
suffixes: &[&[char]],
) -> bool;
fn contains_vowel(&self) -> 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_ch(&self, other: &[char]) -> bool
fn eq_ch(&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_str(&self, other: &str) -> bool
fn eq_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_str(&self, others: &[&str]) -> bool
fn eq_any_ignore_ascii_case_str(&self, others: &[&str]) -> bool
Case-insensitive comparison with any of a list of string slices, 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 starts_with_ignore_ascii_case_str(&self, prefix: &str) -> bool
fn starts_with_ignore_ascii_case_str(&self, prefix: &str) -> bool
Case-insensitive check if the string starts with the given ASCII prefix. The prefix is assumed to be lowercase.
Sourcefn starts_with_any_ignore_ascii_case_str(&self, prefixes: &[&str]) -> bool
fn starts_with_any_ignore_ascii_case_str(&self, prefixes: &[&str]) -> bool
Case-insensitive check if the string starts with any of the given ASCII prefixes. The prefixes are assumed to be lowercase.
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.
Sourcefn ends_with_any_ignore_ascii_case_chars(&self, suffixes: &[&[char]]) -> bool
fn ends_with_any_ignore_ascii_case_chars(&self, suffixes: &[&[char]]) -> bool
Case-insensitive check if the string ends with any of the given ASCII suffixes. The suffixes are assumed to be lowercase.
Sourcefn contains_vowel(&self) -> bool
fn contains_vowel(&self) -> bool
Check if the string contains any vowels
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
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.