pub trait PatternMatchMany {
    // Required methods
    fn pattern_match_many(
        &self,
        patterns: &[&str],
        case_insensitive: bool
    ) -> bool;
    fn pattern_match_many_ci(&self, patterns: &[&str]) -> bool;
    fn pattern_match_many_cs(&self, patterns: &[&str]) -> bool;
    fn pattern_match_many_mixed(&self, pattern_sets: &[(&str, bool)]) -> bool;
    fn pattern_match_many_conditional(
        &self,
        pattern_sets: &[(bool, &str, bool)]
    ) -> bool;
    fn pattern_replace_pairs(&self, replacement_sets: &[(&str, &str)]) -> Self
       where Self: Sized;
    fn pattern_replace_sets(
        &self,
        replacement_sets: &[(&str, &str, bool)]
    ) -> Self
       where Self: Sized;
}
Expand description

Provides methods to match and replace with multiple patterns expressed as arrays of tuples or simple strs (for pattern_match_many_ci and pattern_match_many_cs)

Required Methods§

source

fn pattern_match_many(&self, patterns: &[&str], case_insensitive: bool) -> bool

Matches all of the patterns in case-sensitivity flag with an array of tuples (patterns, case_insensitive)

source

fn pattern_match_many_ci(&self, patterns: &[&str]) -> bool

Matches all of the patterns in case-insensitive mode with an array of str patterns

source

fn pattern_match_many_cs(&self, patterns: &[&str]) -> bool

Matches all of the patterns in case-sensitive mode with an array of str patterns

source

fn pattern_match_many_mixed(&self, pattern_sets: &[(&str, bool)]) -> bool

Matches all of the patterns with case-insensitive flag e.g. (r#“a[ck]”#, true) => matches “ac” or “ak” whether upper, lower or mixed case with an array of tuples (pattern, replacement, case_insensitive)

source

fn pattern_match_many_conditional( &self, pattern_sets: &[(bool, &str, bool)] ) -> bool

string matches all conditional patterns which may be positive / negative and case insensitive or not

source

fn pattern_replace_pairs(&self, replacement_sets: &[(&str, &str)]) -> Self
where Self: Sized,

Replaces multiple sets of patterns with replacements and boolean case sensitivity with an array of tuples (pattern, replacement, case_insensitive)

source

fn pattern_replace_sets(&self, replacement_sets: &[(&str, &str, bool)]) -> Self
where Self: Sized,

Replaces multiple sets of patterns with replacements in case-sensitive mode with an array of simple tuples (pattern, replacement)

Implementations on Foreign Types§

source§

impl PatternMatchMany for String

source§

fn pattern_match_many(&self, patterns: &[&str], case_insensitive: bool) -> bool

Matches all of the patterns in case-sensitivity flag with an array of tuples (patterns, case_insensitive)

source§

fn pattern_match_many_ci(&self, patterns: &[&str]) -> bool

Matches all of the patterns in case-insensitive mode with an array of str patterns

source§

fn pattern_match_many_cs(&self, patterns: &[&str]) -> bool

Matches all of the patterns in case-sensitive mode with an array of str patterns

source§

fn pattern_match_many_mixed(&self, pattern_sets: &[(&str, bool)]) -> bool

Matches all of the patterns with case-insensitive flag e.g. (r#“a[ck]”#, true) => matches “ac” or “ak” whether upper, lower or mixed case with an array of tuples (pattern, replacement, case_insensitive)

source§

fn pattern_match_many_conditional( &self, pattern_sets: &[(bool, &str, bool)] ) -> bool

Matches all of the patterns with positivity condition and case-insensitive flag e.g. (false, “a[ck]”, true) => does not contain “ac” or “ak” whether upper, lower or mixed case with an array of tuples (positive, pattern, case_insensitive)

source§

fn pattern_replace_sets( &self, replacement_sets: &[(&str, &str, bool)] ) -> String

Replaces multiple sets of patterns with replacements and boolean case sensitivity with an array of tuples (pattern, replacement, case_insensitive)

source§

fn pattern_replace_pairs(&self, replacement_pairs: &[(&str, &str)]) -> String

Replaces multiple sets of patterns with replacements in case-sensitive mode with an array of simple tuples (pattern, replacement)

source§

impl PatternMatchMany for Vec<String>

Implement PatternMatchMany for vectors of strings.

source§

fn pattern_match_many(&self, patterns: &[&str], case_insensitive: bool) -> bool

source§

fn pattern_match_many_ci(&self, patterns: &[&str]) -> bool

source§

fn pattern_match_many_cs(&self, patterns: &[&str]) -> bool

source§

fn pattern_match_many_mixed(&self, pattern_sets: &[(&str, bool)]) -> bool

source§

fn pattern_match_many_conditional( &self, pattern_sets: &[(bool, &str, bool)] ) -> bool

source§

fn pattern_replace_sets( &self, replacement_sets: &[(&str, &str, bool)] ) -> Vec<String>

source§

fn pattern_replace_pairs( &self, replacement_pairs: &[(&str, &str)] ) -> Vec<String>

Implementors§