price_checker/src/parser.rs

30 lines
510 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 Parser{
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: & dyn Parser)]
pub struct List {
#[in_array(get)]
darty: darty::Darty
}
impl List {
pub fn new() -> Self {
List {
darty: darty::Darty::new()
}
}
}