pub mod darty; extern crate arraygen; extern crate url; use scraper::Html; use crate::price_result::PriceResult; use arraygen::Arraygen; use url::Url; use anyhow::Result; pub trait PriceParser{ fn new() -> Result where Self :Sized; fn can_parse(&self, url : &Url) -> bool; fn parse(&self, html : &Html) -> Result; } #[derive(Arraygen, Debug)] #[gen_array(pub fn get_price: & dyn PriceParser)] pub struct List { #[in_array(get_price)] darty: darty::Darty } impl List { pub fn new() -> Result { Ok(List { darty: darty::Darty::new()? }) } }