Meilleur utilisation d'itérateur

master
Rémi BERTHO 3 years ago
commit 5769c7b11f
Signed by: dalan
GPG Key ID: EE3B917931C07B64
  1. 12
      src/price_checker.rs

@ -27,15 +27,7 @@ impl PriceChecker {
let response = self.client.get(url.clone()).send().unwrap();
let text = response.text().unwrap();
let document = Html::parse_document(&text);
for parser in self.parser_list.get().iter() {
if parser.can_parse(&url) {
return parser.parse(&document);
}
}
PriceResult {
name: "name".to_owned(),
product: "family".to_owned(),
price: 0.
}
let parser = *self.parser_list.get().iter().find(|p| p.can_parse(&url)).unwrap();
parser.parse(&document)
}
}
Loading…
Cancel
Save