pub struct PathFilter {
pub only: Vec<Pattern>,
pub exclude: Vec<Pattern>,
}Expand description
Pre-walk path filter for --only / --exclude glob patterns.
Compiled once in the service layer and threaded to each rule engine so files can be skipped before parsing or walking. The post-walk filter in the service layer remains as a safety net.
Fields§
§only: Vec<Pattern>§exclude: Vec<Pattern>Implementations§
Source§impl PathFilter
impl PathFilter
Sourcepub fn new(only: &[String], exclude: &[String]) -> Self
pub fn new(only: &[String], exclude: &[String]) -> Self
Build a PathFilter from raw glob strings (as provided by CLI flags).
Invalid patterns are silently dropped (matches the post-walk filter behavior).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if this filter has no patterns (i.e. passes everything).
Sourcepub fn matches(&self, rel_path: &str) -> bool
pub fn matches(&self, rel_path: &str) -> bool
Check whether a relative path passes the filter.
- If
onlyis non-empty, the path must match at least oneonlypattern. - If
excludeis non-empty, the path must not match anyexcludepattern.
Sourcepub fn matches_path(&self, rel_path: &Path) -> bool
pub fn matches_path(&self, rel_path: &Path) -> bool
Convenience: check a Path by converting to a string first.
Trait Implementations§
Source§impl Clone for PathFilter
impl Clone for PathFilter
Source§fn clone(&self) -> PathFilter
fn clone(&self) -> PathFilter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PathFilter
impl Debug for PathFilter
Source§impl Default for PathFilter
impl Default for PathFilter
Source§fn default() -> PathFilter
fn default() -> PathFilter
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PathFilter
impl RefUnwindSafe for PathFilter
impl Send for PathFilter
impl Sync for PathFilter
impl Unpin for PathFilter
impl UnsafeUnpin for PathFilter
impl UnwindSafe for PathFilter
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