pub struct ExclusionMatcher {
root: PathBuf,
options: ExclusionOptions,
overrides: Override,
}Expand description
Matcher bound to one index root.
Fields§
§root: PathBuf§options: ExclusionOptions§overrides: OverrideImplementations§
Source§impl ExclusionMatcher
impl ExclusionMatcher
Sourcepub fn new(root: impl Into<PathBuf>, options: ExclusionOptions) -> Self
pub fn new(root: impl Into<PathBuf>, options: ExclusionOptions) -> Self
Build a matcher for root. Invalid override globs are skipped.
Sourcepub fn options(&self) -> &ExclusionOptions
pub fn options(&self) -> &ExclusionOptions
Options used to build this matcher.
Sourcepub fn is_excluded(&self, path: &Path) -> bool
pub fn is_excluded(&self, path: &Path) -> bool
Whether path is excluded by hidden / secret / noise / gitignore rules.
Include globs are not applied here; see Self::should_process.
Sourcepub fn should_process(&self, path: &Path) -> bool
pub fn should_process(&self, path: &Path) -> bool
Whether a file should be indexed (not excluded and matches include globs).
Sourcepub fn should_descend(&self, path: &Path) -> bool
pub fn should_descend(&self, path: &Path) -> bool
Whether a directory should be descended into during a hand-rolled walk.
Sourcepub fn collect_files(&self) -> Vec<PathBuf>
pub fn collect_files(&self) -> Vec<PathBuf>
Walk the index root with the ignore crate (WalkBuilder).
Hidden opt-in, secret/noise overrides, and gitignore (no parents, no global gitignore) are applied here. Include globs are applied after.
Sourcepub fn collect_files_with_status(&self) -> (Vec<PathBuf>, bool)
pub fn collect_files_with_status(&self) -> (Vec<PathBuf>, bool)
Return eligible files and whether every visited entry was readable. An incomplete walk must never be used to infer deletions.
Trait Implementations§
Source§impl Clone for ExclusionMatcher
impl Clone for ExclusionMatcher
Auto Trait Implementations§
impl Freeze for ExclusionMatcher
impl RefUnwindSafe for ExclusionMatcher
impl Send for ExclusionMatcher
impl Sync for ExclusionMatcher
impl Unpin for ExclusionMatcher
impl UnsafeUnpin for ExclusionMatcher
impl UnwindSafe for ExclusionMatcher
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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