price_checker/src/parser.rs

28 lines
478 B
Rust

pub mod darty;
extern crate arraygen;
use scraper::Html;
use crate::price_result::PriceResult;
use arraygen::Arraygen;
pub trait Parser{
fn new() -> Self where Self :Sized;
fn can_parse(&self, url : &str) -> 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()
}
}
}