generated from OBJNULL/Dockerized-Rust
Compare commits
No commits in common. "5d5df73b7c12daf8e2299b89c81c3f24b0bece01" and "9892b663d25103a74fe5bce65255255959786eea" have entirely different histories.
5d5df73b7c
...
9892b663d2
2 changed files with 7 additions and 17 deletions
|
@ -1,10 +1,9 @@
|
|||
// Libraries
|
||||
mod calculator;
|
||||
mod scraper;
|
||||
use calculator::{CalculationResult, Calculator};
|
||||
use scraper::Scraper;
|
||||
use std::io::Result;
|
||||
|
||||
use calculator::{CalculationResult, Calculator};
|
||||
|
||||
// Structures
|
||||
pub struct Backend {
|
||||
memberships: Vec<String>,
|
||||
|
@ -23,18 +22,11 @@ impl Backend {
|
|||
/// ```rs
|
||||
/// let backend = Backend::new(true)?;
|
||||
/// ```
|
||||
pub async fn new(fetch: bool) -> Result<Self> {
|
||||
pub fn new(fetch: bool) -> Result<Self> {
|
||||
// Did we want to fetch our prices?
|
||||
let memberships: Vec<String> = if fetch {
|
||||
// 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?
|
||||
// Use Internet to get prices
|
||||
unimplemented!("TODO: Implement online Membership Price Fetching");
|
||||
} else {
|
||||
// Manually creating our prices
|
||||
vec![
|
||||
|
|
|
@ -5,13 +5,11 @@ mod backend;
|
|||
use backend::Backend;
|
||||
use std::io::Result;
|
||||
use std::rc::Rc;
|
||||
use tokio;
|
||||
|
||||
// Entry Point
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
fn main() -> Result<()> {
|
||||
// Creating a Backend
|
||||
let backend = Rc::new(Backend::new(true).await?);
|
||||
let backend = Rc::new(Backend::new(false)?);
|
||||
|
||||
// Creating a new App
|
||||
let app = App::new(Rc::clone(&backend))?;
|
||||
|
|
Loading…
Reference in a new issue