Backend properly implements TOKIO & Scraper

This commit is contained in:
Maddox Werts 2025-08-02 16:23:25 -04:00
parent 9892b663d2
commit 80c6b51d01

View file

@ -1,8 +1,9 @@
// Libraries
mod calculator;
use std::io::Result;
mod scraper;
use calculator::{CalculationResult, Calculator};
use scraper::Scraper;
use std::io::Result;
// Structures
pub struct Backend {
@ -22,11 +23,18 @@ impl Backend {
/// ```rs
/// let backend = Backend::new(true)?;
/// ```
pub fn new(fetch: bool) -> Result<Self> {
pub async fn new(fetch: bool) -> Result<Self> {
// Did we want to fetch our prices?
let memberships: Vec<String> = if fetch {
// Use Internet to get prices
unimplemented!("TODO: Implement online Membership Price Fetching");
// Getting the URL to scrape from
let scrape_url =
"https://www.washluberepair.com/location/frederick-auto-spa-express-rt-85/";
// Fetching with our Scraper
let scraper = Scraper::new(scrape_url);
// Scraping
scraper.start().await?
} else {
// Manually creating our prices
vec![