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>
pub fn find_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 find_content(
&self,
candidate: &Path,
desired_len: usize,
) -> Option<ContentMatch>
pub fn find_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 and you already know the content is there so you don’t want to filter by name/path
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnwindSafe for Pattern
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more