use std::path::Path;
use crate::datastore::DataStore;
use crate::fs::Fs;
use crate::handlers::{
ExecutionPhase, Handler, HandlerConfig, HandlerStatus, HANDLER_IGNORE, HANDLER_SKIP,
};
use crate::operations::HandlerIntent;
use crate::paths::Pather;
use crate::rules::RuleMatch;
use crate::Result;
pub struct IgnoreHandler;
impl Handler for IgnoreHandler {
fn name(&self) -> &str {
HANDLER_IGNORE
}
fn phase(&self) -> ExecutionPhase {
ExecutionPhase::Filter
}
fn to_intents(
&self,
_matches: &[RuleMatch],
_config: &HandlerConfig,
_paths: &dyn Pather,
_fs: &dyn Fs,
) -> Result<Vec<HandlerIntent>> {
Ok(Vec::new())
}
fn check_status(
&self,
file: &Path,
_pack: &str,
_datastore: &dyn DataStore,
) -> Result<HandlerStatus> {
Ok(HandlerStatus {
file: file.to_string_lossy().into_owned(),
handler: HANDLER_IGNORE.into(),
deployed: false,
message: String::new(),
})
}
}
pub struct SkipHandler;
impl Handler for SkipHandler {
fn name(&self) -> &str {
HANDLER_SKIP
}
fn phase(&self) -> ExecutionPhase {
ExecutionPhase::Filter
}
fn to_intents(
&self,
_matches: &[RuleMatch],
_config: &HandlerConfig,
_paths: &dyn Pather,
_fs: &dyn Fs,
) -> Result<Vec<HandlerIntent>> {
Ok(Vec::new())
}
fn check_status(
&self,
file: &Path,
_pack: &str,
_datastore: &dyn DataStore,
) -> Result<HandlerStatus> {
Ok(HandlerStatus {
file: file.to_string_lossy().into_owned(),
handler: HANDLER_SKIP.into(),
deployed: false,
message: String::new(),
})
}
}