use super::regex::Regex; use std::str::FromStr; #[derive(Debug, Serialize)] pub struct Tag { pub id: u32, pub name: String, } pub fn parse(s: &str) -> Vec { let reg_tag = Regex::new(r#"(?is)(.*?)"#).unwrap(); reg_tag.captures_iter(s) .map(|c| { Tag { id: u32::from_str(c.at(1).unwrap()).unwrap(), name: c.at(2).unwrap().into(), } }) .collect() }