Create a parser class to parse xml implement
pub struct Parser { pub name: String, } impl Parser { pub fn parse(&self, text: &str) -> Result<Vec<String>, std::io::Error> { let re = Regex::new(r"<(\w+)").unwrap(); let mut matched = Vec::with_capacity(10); for cap in re.captures_iter(text) { matched.push(cap[1].to_string()); } match matched.len() { 0 => Err(std::io::Error::new(std::io::ErrorKind::Other, "no match found")), _ => Ok(matched), } } }