pub struct Search {
pub patterns: Vec<List<Ignore>>,
}Expand description
A grouping of lists of patterns while possibly keeping associated to their base path in order to find matches.
Pattern lists with base path are queryable relative to that base, otherwise they are relative to the repository root.
Fields§
§patterns: Vec<List<Ignore>>A list of pattern lists, each representing a patterns from a file or specified by hand, in the order they were specified in.
When matching, this order is reversed.
Implementations§
Source§impl Search
Instantiation of a search for ignore patterns.
impl Search
Instantiation of a search for ignore patterns.
Sourcepub fn from_git_dir(
git_dir: &Path,
excludes_file: Option<PathBuf>,
buf: &mut Vec<u8>,
) -> Result<Self>
pub fn from_git_dir( git_dir: &Path, excludes_file: Option<PathBuf>, buf: &mut Vec<u8>, ) -> Result<Self>
Given git_dir, a .git repository, load static ignore patterns from info/exclude
and from excludes_file if it is provided.
Note that it’s not considered an error if the provided excludes_file does not exist.
Sourcepub fn from_overrides(
patterns: impl IntoIterator<Item = impl Into<OsString>>,
) -> Self
pub fn from_overrides( patterns: impl IntoIterator<Item = impl Into<OsString>>, ) -> Self
Parse a list of ignore patterns, using slashes as path separators.
Source§impl Search
Mutation
impl Search
Mutation
Sourcepub fn add_patterns_buffer(
&mut self,
bytes: &[u8],
source: impl Into<PathBuf>,
root: Option<&Path>,
)
pub fn add_patterns_buffer( &mut self, bytes: &[u8], source: impl Into<PathBuf>, root: Option<&Path>, )
Add patterns as parsed from bytes, providing their source path and possibly their root path, the path they
are relative to. This also means that source is contained within root if root is provided.
Source§impl Search
Matching of ignore patterns.
impl Search
Matching of ignore patterns.
Sourcepub fn pattern_matching_relative_path(
&self,
relative_path: &BStr,
is_dir: Option<bool>,
case: Case,
) -> Option<Match<'_>>
pub fn pattern_matching_relative_path( &self, relative_path: &BStr, is_dir: Option<bool>, case: Case, ) -> Option<Match<'_>>
Match relative_path and return the first match if found.
is_dir is true if relative_path is a directory.
case specifies whether cases should be folded during matching or not.