(&mut self, s: String)
| 45 | } |
| 46 | |
| 47 | pub fn add(&mut self, s: String) { |
| 48 | let normalized: String = s.to_lowercase() |
| 49 | .chars() |
| 50 | .map(|c| if c.is_alphanumeric() { c } else { '-' }) |
| 51 | .collect(); |
| 52 | for part in normalized.split('-').filter(|p| !p.is_empty()) { |
| 53 | self.parts.push(part.to_string()); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | pub fn build(&self) -> String { |
| 58 | self.parts.join("-") |
no test coverage detected