logo
pub trait Filterer: Debug + Send + Sync {
    fn check_event(
        &self,
        event: &Event,
        priority: Priority
    ) -> Result<bool, RuntimeError>; }
Expand description

An interface for filtering events.

Required Methods

Called on (almost) every event, and should return false if the event is to be discarded.

Checking whether an event passes a filter is synchronous, should be fast, and must not block the thread. Do any expensive stuff upfront during construction of your filterer, or in a separate thread/task, as needed.

Returning an error will also fail the event processing, but the error will be propagated to the watchexec error handler. While the type signature supports any RuntimeError, it’s preferred that you create your own error type and return it wrapped in the RuntimeError::Filterer variant with the name of your filterer as kind.

Implementations on Foreign Types

Implementors