Struct ignore_files::IgnoreFilter
source · pub struct IgnoreFilter { /* private fields */ }
Expand description
A mutable filter dedicated to ignore files and trees of ignore files.
This reads and compiles ignore files, and should be used for handling ignore files. It’s created
with a project origin and a list of ignore files, and new ignore files can be added later
(unless finish
is called).
Implementations§
source§impl IgnoreFilter
impl IgnoreFilter
sourcepub fn empty(origin: impl AsRef<Path>) -> Self
pub fn empty(origin: impl AsRef<Path>) -> Self
Create a new empty filterer.
Prefer new()
if you have ignore files ready to use.
sourcepub async fn new(
origin: impl AsRef<Path> + Send,
files: &[IgnoreFile]
) -> Result<Self, Error>
pub async fn new( origin: impl AsRef<Path> + Send, files: &[IgnoreFile] ) -> Result<Self, Error>
Read ignore files from disk and load them for filtering.
Use empty()
if you want an empty filterer,
or to construct one outside an async environment.
sourcepub fn num_ignores(&self) -> (u64, u64)
pub fn num_ignores(&self) -> (u64, u64)
Returns the number of ignores and allowlists loaded.
sourcepub fn finish(&mut self)
pub fn finish(&mut self)
Deletes the internal builder, to save memory.
This makes it impossible to add new ignore files without re-compiling the whole set.
sourcepub async fn add_file(&mut self, file: &IgnoreFile) -> Result<(), Error>
pub async fn add_file(&mut self, file: &IgnoreFile) -> Result<(), Error>
Reads and adds an ignore file, if the builder is available.
Does nothing silently otherwise.
sourcepub fn add_globs(
&mut self,
globs: &[&str],
applies_in: Option<&PathBuf>
) -> Result<(), Error>
pub fn add_globs( &mut self, globs: &[&str], applies_in: Option<&PathBuf> ) -> Result<(), Error>
Adds some globs manually, if the builder is available.
Does nothing silently otherwise.
Trait Implementations§
source§impl Clone for IgnoreFilter
impl Clone for IgnoreFilter
source§fn clone(&self) -> IgnoreFilter
fn clone(&self) -> IgnoreFilter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more