pub enum Pattern {
None,
NameExact(ExactPattern),
NameFuzzy(FuzzyPattern),
NameRegex(RegexPattern),
NameTokens(TokPattern),
PathExact(ExactPattern),
PathFuzzy(FuzzyPattern),
PathRegex(RegexPattern),
PathTokens(TokPattern),
ContentExact(ContentExactPattern),
ContentRegex(ContentRegexPattern),
Composite(CompositePattern),
}
Expand description
a pattern for filtering and sorting files.
Variants§
None
NameExact(ExactPattern)
NameFuzzy(FuzzyPattern)
NameRegex(RegexPattern)
NameTokens(TokPattern)
PathExact(ExactPattern)
PathFuzzy(FuzzyPattern)
PathRegex(RegexPattern)
PathTokens(TokPattern)
ContentExact(ContentExactPattern)
ContentRegex(ContentRegexPattern)
Composite(CompositePattern)
Implementations§
source§impl Pattern
impl Pattern
pub fn new(
raw_expr: &BeTree<PatternOperator, PatternParts>,
search_modes: &SearchModeMap,
content_search_max_file_size: usize
) -> Result<Self, PatternError>
pub fn object(&self) -> PatternObject
pub fn search_string(&self, candidate: &str) -> Option<NameMatch>
sourcepub fn search_content(
&self,
candidate: &Path,
desired_len: usize
) -> Option<ContentMatch>
pub fn search_content(
&self,
candidate: &Path,
desired_len: usize
) -> Option<ContentMatch>
find the content to show next to the name of the file when the search involved a content filtering
sourcepub fn get_match_line_count(&self, path: &Path) -> Option<usize>
pub fn get_match_line_count(&self, path: &Path) -> Option<usize>
get the line of the first match, if any
pub fn score_of(&self, candidate: Candidate<'_>) -> Option<i32>
pub fn score_of_string(&self, candidate: &str) -> Option<i32>
pub fn is_some(&self) -> bool
sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
an empty pattern is one which doesn’t discriminate (it accepts everything)
sourcepub fn has_real_scores(&self) -> bool
pub fn has_real_scores(&self) -> bool
whether the scores are more than just 0 or 1. When it’s the case, the tree builder will look for more matching results in order to select the best ones.