pub struct IgnoreFilter { /* private fields */ }Expand description
Filter for gitignore-style patterns.
Implementations§
Source§impl IgnoreFilter
impl IgnoreFilter
Sourcepub fn new() -> IgnoreFilter
pub fn new() -> IgnoreFilter
Create an empty ignore filter.
Sourcepub fn with_defaults() -> IgnoreFilter
pub fn with_defaults() -> IgnoreFilter
Create a filter with default ignores for common build artifacts.
Sourcepub async fn from_gitignore(
path: &Path,
fs: &impl WalkerFs,
) -> Result<IgnoreFilter, WalkerError>
pub async fn from_gitignore( path: &Path, fs: &impl WalkerFs, ) -> Result<IgnoreFilter, WalkerError>
Load patterns from a gitignore file via WalkerFs.
Rejects files larger than 1 MiB to prevent memory exhaustion.
Sourcepub fn is_ignored(&self, path: &Path, is_dir: bool) -> bool
pub fn is_ignored(&self, path: &Path, is_dir: bool) -> bool
Check if a path should be ignored.
Returns true if the path matches any non-negated rule and doesn’t match a later negated rule.
Sourcepub fn is_name_ignored(&self, name: &str, is_dir: bool) -> bool
pub fn is_name_ignored(&self, name: &str, is_dir: bool) -> bool
Check if a path component (single name) should be ignored.
This is for quick filtering during directory traversal.
Sourcepub fn merge(&mut self, other: &IgnoreFilter)
pub fn merge(&mut self, other: &IgnoreFilter)
Merge another filter’s rules into this one.
The other filter’s rules are added after (and thus take precedence over) this filter’s rules.
Sourcepub fn merged_with(&self, other: &IgnoreFilter) -> IgnoreFilter
pub fn merged_with(&self, other: &IgnoreFilter) -> IgnoreFilter
Create a new filter by merging this filter with another.
Returns a new filter with the combined rules (other’s rules take precedence).
Trait Implementations§
Source§impl Clone for IgnoreFilter
impl Clone for IgnoreFilter
Source§fn clone(&self) -> IgnoreFilter
fn clone(&self) -> IgnoreFilter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IgnoreFilter
impl Debug for IgnoreFilter
Source§impl Default for IgnoreFilter
impl Default for IgnoreFilter
Source§fn default() -> IgnoreFilter
fn default() -> IgnoreFilter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IgnoreFilter
impl RefUnwindSafe for IgnoreFilter
impl Send for IgnoreFilter
impl Sync for IgnoreFilter
impl Unpin for IgnoreFilter
impl UnsafeUnpin for IgnoreFilter
impl UnwindSafe for IgnoreFilter
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