Meilleur utilisation d'itérateur
This commit is contained in:
commit
5769c7b11f
1 changed files with 2 additions and 10 deletions
|
@ -27,15 +27,7 @@ impl PriceChecker {
|
||||||
let response = self.client.get(url.clone()).send().unwrap();
|
let response = self.client.get(url.clone()).send().unwrap();
|
||||||
let text = response.text().unwrap();
|
let text = response.text().unwrap();
|
||||||
let document = Html::parse_document(&text);
|
let document = Html::parse_document(&text);
|
||||||
for parser in self.parser_list.get().iter() {
|
let parser = *self.parser_list.get().iter().find(|p| p.can_parse(&url)).unwrap();
|
||||||
if parser.can_parse(&url) {
|
parser.parse(&document)
|
||||||
return parser.parse(&document);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PriceResult {
|
|
||||||
name: "name".to_owned(),
|
|
||||||
product: "family".to_owned(),
|
|
||||||
price: 0.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue