Skip to main content

CharStringExt

Trait CharStringExt 

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

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_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.

Source

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.

Source

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.

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 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.

Source

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.

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.

Source

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.

Source

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]

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_str(&self, other: &str) -> bool

Source§

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

Source§

fn eq_any_ignore_ascii_case_str(&self, others: &[&str]) -> bool

Source§

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

Source§

fn starts_with_ignore_ascii_case_str(&self, prefix: &str) -> bool

Source§

fn starts_with_any_ignore_ascii_case_str(&self, prefixes: &[&str]) -> 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

Source§

fn ends_with_any_ignore_ascii_case_chars(&self, suffixes: &[&[char]]) -> bool

Source§

fn contains_vowel(&self) -> bool

Implementors§