Compare commits

...

2 commits

Author SHA1 Message Date
5d5df73b7c Main implements TOKIO 2025-08-02 16:23:35 -04:00
80c6b51d01 Backend properly implements TOKIO & Scraper 2025-08-02 16:23:25 -04:00
2 changed files with 17 additions and 7 deletions

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![

View file

@ -5,11 +5,13 @@ mod backend;
use backend::Backend;
use std::io::Result;
use std::rc::Rc;
use tokio;
// Entry Point
fn main() -> Result<()> {
#[tokio::main]
async fn main() -> Result<()> {
// Creating a Backend
let backend = Rc::new(Backend::new(false)?);
let backend = Rc::new(Backend::new(true).await?);
// Creating a new App
let app = App::new(Rc::clone(&backend))?;