CharStringExt

Trait CharStringExt 

Source
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§

Source

fn to_lower(&self) -> Cow<'_, [char]>

Convert all characters to lowercase, returning a new owned vector if any changes were made.

Source

fn normalized(&self) -> Cow<'_, [char]>

Normalize the character sequence according to the dictionary’s standard character set.

Source

fn to_string(&self) -> String

Convert the character sequence to a String.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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]

Source§

fn normalized(&self) -> Cow<'_, [char]>

Convert a given character sequence to the standard character set the dictionary is in.

Source§

fn to_lower(&self) -> Cow<'_, [char]>

Source§

fn to_string(&self) -> String

Source§

fn eq_ignore_ascii_case_str(&self, other: &str) -> bool

Source§

fn eq_ignore_ascii_case_chars(&self, other: &[char]) -> bool

Source§

fn eq_any_ignore_ascii_case_chars(&self, others: &[&[char]]) -> bool

Source§

fn ends_with_ignore_ascii_case_str(&self, suffix: &str) -> bool

Source§

fn ends_with_ignore_ascii_case_chars(&self, suffix: &[char]) -> bool

Implementors§