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

source

pub fn empty(origin: impl AsRef<Path>) -> Self

Create a new empty filterer.

Prefer new() if you have ignore files ready to use.

source

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.

source

pub fn num_ignores(&self) -> (u64, u64)

Returns the number of ignores and allowlists loaded.

source

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.

source

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.

source

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.

source

pub fn match_path(&self, path: &Path, is_dir: bool) -> Match<&Glob>

Match a particular path against the ignore set.

source

pub fn check_dir(&self, path: &Path) -> bool

Check a particular folder path against the ignore set.

Returns false if the folder should be ignored.

Note that this is a slightly different implementation than watchexec’s Filterer trait, as the latter handles events with multiple associated paths.

Trait Implementations§

source§

impl Clone for IgnoreFilter

source§

fn clone(&self) -> IgnoreFilter

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for IgnoreFilter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more