pub const SEPARATOR: char = '.'; pub const MAX_SUBJECT_LEN: usize = 255; pub const MAX_TOKEN_LEN: usize = 64; fn is_token_char(c: char) -> bool { !(c.is_whitespace() || c.is_control() || matches!(c, '.' | '*' | '>' | '/' | '\\' | '$')) } pub fn is_specific(subject: &str) -> bool { !subject.is_empty() && subject.len() <= MAX_SUBJECT_LEN && subject.split(SEPARATOR).all(|token| { !token.is_empty() && token.len() <= MAX_TOKEN_LEN && token.chars().all(is_token_char) }) } pub fn normalize(value: &str) -> String { value.trim().trim_matches(SEPARATOR).to_owned() }