Trait string_patterns::pattern_filter::PatternFilter
source · pub trait PatternFilter<'a, T>where
T: Sized,{
// Required method
fn pattern_filter(&'a self, pattern: &str, case_insensitive: bool) -> Vec<T>;
// Provided methods
fn pattern_filter_ci(&'a self, pattern: &str) -> Vec<T> { ... }
fn pattern_filter_cs(&'a self, pattern: &str) -> Vec<T> { ... }
fn pattern_filter_word(
&'a self,
pattern: &str,
case_insensitive: bool
) -> Vec<T> { ... }
fn pattern_filter_word_ci(&'a self, pattern: &str) -> Vec<T> { ... }
fn pattern_filter_word_cs(&'a self, pattern: &str) -> Vec<T> { ... }
}
Expand description
Trait with methods to filter arrays or vectors of strings by regular expression patterns Only pattern_filter() method needs to be implemented. Both implementations ensure the regex is compiled only once. If the regex fails, filters will not be applied.
Required Methods§
sourcefn pattern_filter(&'a self, pattern: &str, case_insensitive: bool) -> Vec<T>
fn pattern_filter(&'a self, pattern: &str, case_insensitive: bool) -> Vec<T>
Filter an array of strs by the pattern
Provided Methods§
sourcefn pattern_filter_ci(&'a self, pattern: &str) -> Vec<T>
fn pattern_filter_ci(&'a self, pattern: &str) -> Vec<T>
Filters strings in case-insensitive mode
sourcefn pattern_filter_cs(&'a self, pattern: &str) -> Vec<T>
fn pattern_filter_cs(&'a self, pattern: &str) -> Vec<T>
Filters strings in case-sensitive mode
sourcefn pattern_filter_word(
&'a self,
pattern: &str,
case_insensitive: bool
) -> Vec<T>
fn pattern_filter_word( &'a self, pattern: &str, case_insensitive: bool ) -> Vec<T>
Filters strings by whole word regex patterns with case-insensitive flag
sourcefn pattern_filter_word_ci(&'a self, pattern: &str) -> Vec<T>
fn pattern_filter_word_ci(&'a self, pattern: &str) -> Vec<T>
Filters strings by whole word regex patterns in case-insensitive mode
sourcefn pattern_filter_word_cs(&'a self, pattern: &str) -> Vec<T>
fn pattern_filter_word_cs(&'a self, pattern: &str) -> Vec<T>
Filters strings by whole word regex patterns in case-sensitive mode