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