Trait string_patterns::pattern_match::PatternMatches
source · pub trait PatternMatches {
// Required methods
fn pattern_matched_pairs_result(
&self,
pattern: &str,
case_insensitive: bool
) -> Result<Vec<(bool, &str)>, Error>;
fn pattern_matched_pairs_default(&self) -> Vec<(bool, &str)>;
// Provided methods
fn pattern_matched_pairs(
&self,
pattern: &str,
case_insensitive: bool
) -> Vec<(bool, &str)> { ... }
fn pattern_matches_result(
&self,
pattern: &str,
case_insensitive: bool
) -> Result<Vec<bool>, Error> { ... }
fn pattern_matches_filtered(
&self,
pattern: &str,
case_insensitive: bool
) -> Vec<&str> { ... }
fn pattern_matches_filtered_ci(&self, pattern: &str) -> Vec<&str> { ... }
fn pattern_matches_filtered_cs(&self, pattern: &str) -> Vec<&str> { ... }
fn pattern_matches(
&self,
pattern: &str,
case_insensitive: bool
) -> Vec<bool> { ... }
fn pattern_matches_ci(&self, pattern: &str) -> Vec<bool> { ... }
fn pattern_matches_cs(&self, pattern: &str) -> Vec<bool> { ... }
}
Expand description
Pattern methods for arrays or vectors only, return vectors of booleans matching each input string
Required Methods§
sourcefn pattern_matched_pairs_result(
&self,
pattern: &str,
case_insensitive: bool
) -> Result<Vec<(bool, &str)>, Error>
fn pattern_matched_pairs_result( &self, pattern: &str, case_insensitive: bool ) -> Result<Vec<(bool, &str)>, Error>
Returns result with a vector of tuples with matched status and string slice for an array or vector of strings with a case-insensitive flag or an error if the regex does not compile
sourcefn pattern_matched_pairs_default(&self) -> Vec<(bool, &str)>
fn pattern_matched_pairs_default(&self) -> Vec<(bool, &str)>
Return a default vector of paired tuples if the regular expression fails in pattern_matched_pairs or pattern_matches This has to implemented separately for all other derived methods returning vectors to work correctly
Provided Methods§
sourcefn pattern_matched_pairs(
&self,
pattern: &str,
case_insensitive: bool
) -> Vec<(bool, &str)>
fn pattern_matched_pairs( &self, pattern: &str, case_insensitive: bool ) -> Vec<(bool, &str)>
Returns a vector of tuples with matched status and string slice for an array or vector of strings with a case-insensitive flag If the regular expression fails all items will be false
sourcefn pattern_matches_result(
&self,
pattern: &str,
case_insensitive: bool
) -> Result<Vec<bool>, Error>
fn pattern_matches_result( &self, pattern: &str, case_insensitive: bool ) -> Result<Vec<bool>, Error>
Returns result with a vector of boolean matches for an array or vector of strings with case-insensitive flag or an error if the regex does not compile
sourcefn pattern_matches_filtered(
&self,
pattern: &str,
case_insensitive: bool
) -> Vec<&str>
fn pattern_matches_filtered( &self, pattern: &str, case_insensitive: bool ) -> Vec<&str>
Returns a filtered vector of matched string slices (&str) with case-insensitive flag
sourcefn pattern_matches_filtered_ci(&self, pattern: &str) -> Vec<&str>
fn pattern_matches_filtered_ci(&self, pattern: &str) -> Vec<&str>
Returns a filtered vector of matched string slices (&str) in case-insensitive mode
sourcefn pattern_matches_filtered_cs(&self, pattern: &str) -> Vec<&str>
fn pattern_matches_filtered_cs(&self, pattern: &str) -> Vec<&str>
Returns a filtered vector of matched string slices (&str) in case-sensitive mode
sourcefn pattern_matches(&self, pattern: &str, case_insensitive: bool) -> Vec<bool>
fn pattern_matches(&self, pattern: &str, case_insensitive: bool) -> Vec<bool>
Returns vector of boolean matches for an array or vector of strings with case-insensitive flag must be reimplemented from pattern_matches_result owing to trait bound constraints on unsized arrays
sourcefn pattern_matches_ci(&self, pattern: &str) -> Vec<bool>
fn pattern_matches_ci(&self, pattern: &str) -> Vec<bool>
Returns vector of boolean matches for an array or vector of strings in case-insensitive mode
sourcefn pattern_matches_cs(&self, pattern: &str) -> Vec<bool>
fn pattern_matches_cs(&self, pattern: &str) -> Vec<bool>
Returns vector of boolean matches for an array or vector of strings in case-sensitive mode
Implementations on Foreign Types§
source§impl PatternMatches for [&str]
impl PatternMatches for [&str]
Multiple match methods for arrays or vectors of &str values
source§fn pattern_matched_pairs_result(
&self,
pattern: &str,
case_insensitive: bool
) -> Result<Vec<(bool, &str)>, Error>
fn pattern_matched_pairs_result( &self, pattern: &str, case_insensitive: bool ) -> Result<Vec<(bool, &str)>, Error>
Returns an Ok result with a vector of boolean matches for an array or vector of strings with a case-insensitive flag and an error only if the regex fails to compile.
fn pattern_matched_pairs_default(&self) -> Vec<(bool, &str)>
source§impl PatternMatches for [String]
impl PatternMatches for [String]
Multiple match methods for arrays or vectors of strings Implemented separately because of irresolvable Iterator trait bounds rules in Rust 2018 and because both String and &str are normalised to vectors with string references in the return types
source§fn pattern_matched_pairs_result(
&self,
pattern: &str,
case_insensitive: bool
) -> Result<Vec<(bool, &str)>, Error>
fn pattern_matched_pairs_result( &self, pattern: &str, case_insensitive: bool ) -> Result<Vec<(bool, &str)>, Error>
Returns an Ok result with a vector of boolean matches for an array or vector of strings with a case-insensitive flag and an error only if the regex fails to compile.