INNER CODE UNIT · Rust
handle
Drew-Alleman/DataSurgeon · src/main.rs:456
fn handle(&mut self, line: &std::io::Result<String>, regex_map: &HashMap<String, Regex>) {
if let Ok(line) = line {
self.line_count += 1;
let mut capture_set: HashSet<String> = HashSet::new();
for (content_type, regex) in regex_map.iter() {
for capture in regex.captures_iter(&line) {
if !self.clean && self.is_worthy(&line) {
self.handle_message(&line, &content_type);
if !self.thorough {
return;
}
}
// Fetch the first member of the capture group
if let Some(capture_match) = capture.get(0) {
let filtered_capture: String = capture_match.as_str().to_string();
if !self.is_worthy(&filtered_capture) {
continue;
}