reorganize List from enum to struct; separate features to children mods

This commit is contained in:
postscriptum 2026-03-22 10:06:26 +02:00
parent 0b6b0ebd0e
commit e5268e49f1
2 changed files with 37 additions and 41 deletions

19
src/list/item.rs Normal file
View file

@ -0,0 +1,19 @@
use log::debug;
#[derive(PartialEq, Eq, Hash)]
pub enum Item {
Ending(String),
Exact(String),
}
impl Item {
pub fn from_line(rule: &str) -> Self {
if let Some(item) = rule.strip_prefix(".") {
debug!("Add `{rule}` to the whitelist");
Self::Ending(item.to_string())
} else {
debug!("Add `{rule}` exact match to the whitelist");
Self::Exact(rule.to_string())
}
}
}