30 lines
532 B
Rust
30 lines
532 B
Rust
pub mod darty;
|
|
|
|
extern crate arraygen;
|
|
extern crate url;
|
|
|
|
use scraper::Html;
|
|
use crate::price_result::PriceResult;
|
|
use arraygen::Arraygen;
|
|
use url::Url;
|
|
|
|
pub trait PriceParser{
|
|
fn new() -> Self where Self :Sized;
|
|
fn can_parse(&self, url : &Url) -> bool;
|
|
fn parse(&self, html : &Html) -> PriceResult;
|
|
}
|
|
|
|
#[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() -> Self {
|
|
List {
|
|
darty: darty::Darty::new()
|
|
}
|
|
}
|
|
} |