diff options
Diffstat (limited to 'src/dl_list.rs')
-rw-r--r-- | src/dl_list.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dl_list.rs b/src/dl_list.rs index 3327388..17d49fc 100644 --- a/src/dl_list.rs +++ b/src/dl_list.rs | |||
@@ -9,5 +9,12 @@ pub struct DLListItem { | |||
9 | pub fn parse(s: &str) -> Vec<DLListItem> { | 9 | pub fn parse(s: &str) -> Vec<DLListItem> { |
10 | let reg_list_item = Regex::new(r#"(?is)<dt.*?>(.*?)</dt>.*?<dd>(.*?)</dd>"#).unwrap(); | 10 | let reg_list_item = Regex::new(r#"(?is)<dt.*?>(.*?)</dt>.*?<dd>(.*?)</dd>"#).unwrap(); |
11 | 11 | ||
12 | reg_list_item.captures_iter(s).map(|c| DLListItem { name: c.at(1).unwrap().into(), value: c.at(2).unwrap().into() }).collect() | 12 | reg_list_item.captures_iter(s) |
13 | .map(|c| { | ||
14 | DLListItem { | ||
15 | name: c.at(1).unwrap().into(), | ||
16 | value: c.at(2).unwrap().into(), | ||
17 | } | ||
18 | }) | ||
19 | .collect() | ||
13 | } | 20 | } |