Start implementing two Filterers (v1 and v2)

This commit is contained in:
Félix Saparelli 2021-09-23 21:59:35 +12:00
parent 7875b4db67
commit b57fa8b236
5 changed files with 40 additions and 5 deletions

View File

@ -1,10 +1,7 @@
#[doc(inline)]
pub use types::*;
use crate::{error::RuntimeError, event::Event};
mod parse;
mod types;
pub mod globset;
pub mod tagged;
pub trait Filterer: Send + Sync {
fn check_event(&self, event: &Event) -> Result<bool, RuntimeError>;

17
lib/src/filter/globset.rs Normal file
View File

@ -0,0 +1,17 @@
//! The watchexec v1 filter implementation, using globset.
use std::path::PathBuf;
use crate::error::RuntimeError;
use crate::event::Event;
use crate::filter::Filterer;
pub struct GlobsetFilterer {
_root: PathBuf,
}
impl Filterer for GlobsetFilterer {
fn check_event(&self, _event: &Event) -> Result<bool, RuntimeError> {
todo!()
}
}

21
lib/src/filter/tagged.rs Normal file
View File

@ -0,0 +1,21 @@
use std::path::PathBuf;
use crate::error::RuntimeError;
use crate::event::Event;
use crate::filter::Filterer;
#[doc(inline)]
pub use types::*;
mod parse;
mod types;
pub struct TaggedFilterer {
_root: PathBuf,
}
impl Filterer for TaggedFilterer {
fn check_event(&self, _event: &Event) -> Result<bool, RuntimeError> {
todo!()
}
}