pub struct PathFilter { /* private fields */ }Expand description
Manages path filtering using .gitignore-style patterns
Implementations§
Source§impl PathFilter
impl PathFilter
Sourcepub fn new(
patterns: Vec<String>,
ignore_filename: Option<String>,
) -> GuardianResult<Self>
pub fn new( patterns: Vec<String>, ignore_filename: Option<String>, ) -> GuardianResult<Self>
Create a new path filter with the given patterns
Sourcepub fn with_defaults() -> GuardianResult<Self>
pub fn with_defaults() -> GuardianResult<Self>
Create a default path filter with sensible exclusions
Sourcepub fn should_analyze<P: AsRef<Path>>(&self, path: P) -> GuardianResult<bool>
pub fn should_analyze<P: AsRef<Path>>(&self, path: P) -> GuardianResult<bool>
Check if a file should be analyzed based on all patterns and ignore files
Sourcepub fn find_files<P: AsRef<Path>>(
&self,
root: P,
) -> GuardianResult<Vec<PathBuf>>
pub fn find_files<P: AsRef<Path>>( &self, root: P, ) -> GuardianResult<Vec<PathBuf>>
Get all files that should be analyzed in a directory tree
Sourcepub fn filter_paths<P: AsRef<Path>>(
&self,
paths: &[P],
) -> GuardianResult<Vec<PathBuf>>
pub fn filter_paths<P: AsRef<Path>>( &self, paths: &[P], ) -> GuardianResult<Vec<PathBuf>>
Filter a list of paths to only those that should be analyzed
Sourcepub fn add_pattern(&mut self, pattern: String) -> GuardianResult<()>
pub fn add_pattern(&mut self, pattern: String) -> GuardianResult<()>
Add a pattern to the filter
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PathFilter
impl RefUnwindSafe for PathFilter
impl Send for PathFilter
impl Sync for PathFilter
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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