pub struct IgnorePatternSet { /* private fields */ }Expand description
The discovery ignore set with its ! exceptions.
matches_into and len read only the ignore globs, in the index layout
that crate::DEFAULT_IGNORE_PATTERNS documents. is_match applies the
exceptions too, so every caller that asks “is this path ignored” gets the
same answer.
Implementations§
Source§impl IgnorePatternSet
impl IgnorePatternSet
Sourcepub fn new(patterns: GlobSet, exception_bodies: &[&str]) -> Self
pub fn new(patterns: GlobSet, exception_bodies: &[&str]) -> Self
Build a set from ignore globs and ! exception bodies (without the
!). Exception bodies that do not compile are dropped, because config
load validates them first.
Sourcepub fn is_match(&self, path: impl AsRef<Path>) -> bool
pub fn is_match(&self, path: impl AsRef<Path>) -> bool
True when the path is ignored: an ignore glob matches it and no !
exception lifts it.
Sourcepub fn matches_into(&self, path: impl AsRef<Path>, into: &mut Vec<usize>)
pub fn matches_into(&self, path: impl AsRef<Path>, into: &mut Vec<usize>)
Indices of the ignore globs that match the path, without the
exceptions. Callers use it only for a path that is_match rejected.
Sourcepub fn matches(&self, path: impl AsRef<Path>) -> Vec<usize>
pub fn matches(&self, path: impl AsRef<Path>) -> Vec<usize>
Indices of the ignore globs that match the path, without the exceptions.
Sourcepub fn has_exceptions(&self) -> bool
pub fn has_exceptions(&self) -> bool
True when the project wrote at least one ! exception.
Sourcepub fn is_lifted(&self, path: impl AsRef<Path>) -> bool
pub fn is_lifted(&self, path: impl AsRef<Path>) -> bool
True when a ! exception matches the path and the path is not under
node_modules or .git.
True when the walk must open the hidden directory dir (a path
relative to the project root) because a ! exception can match a file
inside it. The walk keeps only the files that an exception matches.