Struct gix_ignore::Search
source · 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
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
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
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.
Trait Implementations§
source§impl Ord for Search
impl Ord for Search
source§impl PartialOrd for Search
impl PartialOrd for Search
impl Eq for Search
impl StructuralPartialEq for Search
Auto Trait Implementations§
impl Freeze for Search
impl RefUnwindSafe for Search
impl Send for Search
impl Sync for Search
impl Unpin for Search
impl UnwindSafe for Search
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)