use super::*;
use ::regex::Regex;
#[derive(Debug)]
pub struct RegexFilter {
pub compiled: Regex,
pub raw_string: String,
}
impl FeroxFilter for RegexFilter {
fn should_filter_response(&self, response: &FeroxResponse) -> bool {
log::trace!("enter: should_filter_response({:?} {})", self, response);
let result = self.compiled.is_match(response.text());
log::trace!("exit: should_filter_response -> {}", result);
result
}
fn box_eq(&self, other: &dyn Any) -> bool {
other.downcast_ref::<Self>().map_or(false, |a| self == a)
}
fn as_any(&self) -> &dyn Any {
self
}
}
impl PartialEq for RegexFilter {
fn eq(&self, other: &RegexFilter) -> bool {
self.raw_string == other.raw_string
}
}