1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
use super::StringProcessor; pub struct LowerAlphaNumStringProcessor; pub struct NullStringProcessor; impl StringProcessor for LowerAlphaNumStringProcessor { fn process(&self, input: &str) -> String { let processed: String = input .chars() .filter(|c| c.is_alphanumeric() || c.is_whitespace()) .collect::<String>() .trim() .to_lowercase(); processed } } impl StringProcessor for NullStringProcessor { fn process(&self, input: &str) -> String { input.to_owned() } }