pub struct FileFilter {
pub ignored: Vec<String>,
pub not_ignored: Vec<String>,
pub extensions: Vec<String>,
}
Fields§
§ignored: Vec<String>
§not_ignored: Vec<String>
§extensions: Vec<String>
Implementations§
Source§impl FileFilter
impl FileFilter
pub fn new(ignore: &[String], extensions: Vec<String>) -> Self
Sourcepub fn parse_submodules(&mut self)
pub fn parse_submodules(&mut self)
This function will also read a .gitmodules file located in the working directory. The named submodules’ paths will be automatically added to the ignored list, unless the submodule’s path is already specified in the not_ignored list.
Sourcepub fn is_file_in_list(&self, file_name: &Path, is_ignored: bool) -> bool
pub fn is_file_in_list(&self, file_name: &Path, is_ignored: bool) -> bool
Describes if a specified file_name
is contained within the specified set of paths.
The is_ignored
flag describes which set of paths is used as domains.
The specified file_name
can be a direct or distant descendant of any paths in
the set.
Returns a true
value of the the path/pattern that matches the given file_name
.
If given file_name
is not in the specified set, then false
is returned.
Sourcepub fn is_source_or_ignored(&self, entry: &Path) -> bool
pub fn is_source_or_ignored(&self, entry: &Path) -> bool
A helper function that checks if entry
satisfies the following conditions (in
ordered priority):
- Does
entry
’s path use at least 1 of the listed fileextensions
? (takes precedence) - Is
entry
not specified in list ofignored
paths? - Is
entry
specified in the list of explicitlynot_ignored
paths? (supersedes specifiedignored
paths)
Sourcepub fn list_source_files(&self, root_path: &str) -> Result<Vec<FileObj>>
pub fn list_source_files(&self, root_path: &str) -> Result<Vec<FileObj>>
Walks a given root_path
recursively and returns a Vec<FileObj>
that
- uses at least 1 of the given
extensions
- is not specified in the internal list of
ignored
paths - is specified in the internal list
not_ignored
paths (which supersedesignored
paths)
Trait Implementations§
Source§impl Clone for FileFilter
impl Clone for FileFilter
Source§fn clone(&self) -> FileFilter
fn clone(&self) -> FileFilter
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for FileFilter
impl RefUnwindSafe for FileFilter
impl Send for FileFilter
impl Sync for FileFilter
impl Unpin for FileFilter
impl UnwindSafe for FileFilter
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
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>
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>
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