2021-09-27 13:54:33 +02:00
|
|
|
use std::sync::Arc;
|
|
|
|
|
2021-09-22 13:39:41 +02:00
|
|
|
use crate::{error::RuntimeError, event::Event};
|
|
|
|
|
2021-09-23 11:59:35 +02:00
|
|
|
pub mod globset;
|
|
|
|
pub mod tagged;
|
2021-09-22 13:39:41 +02:00
|
|
|
|
|
|
|
pub trait Filterer: Send + Sync {
|
|
|
|
fn check_event(&self, event: &Event) -> Result<bool, RuntimeError>;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Filterer for () {
|
|
|
|
fn check_event(&self, _event: &Event) -> Result<bool, RuntimeError> {
|
|
|
|
Ok(true)
|
|
|
|
}
|
|
|
|
}
|
2021-09-27 13:54:33 +02:00
|
|
|
|
|
|
|
impl<T: Filterer> Filterer for Arc<T> {
|
|
|
|
fn check_event(&self, event: &Event) -> Result<bool, RuntimeError> {
|
|
|
|
Arc::as_ref(self).check_event(event)
|
|
|
|
}
|
|
|
|
}
|