parent
e3174f21af
commit
27a61f8a9a
|
@ -1,5 +1,7 @@
|
|||
use super::search::Street;
|
||||
use chrono::NaiveDate;
|
||||
use rocket::http::RawStr;
|
||||
use rocket::request::FromFormValue;
|
||||
use std::error::Error;
|
||||
|
||||
const BASE_URL: &str = "https://www.ivago.be/nl/particulier/afval/ophaling";
|
||||
|
@ -13,6 +15,17 @@ pub struct PickupTime {
|
|||
url: String,
|
||||
}
|
||||
|
||||
impl<'v> FromFormValue<'v> for NaiveDate {
|
||||
type Error = &'v RawStr;
|
||||
|
||||
fn from_form_value(form_value: &'v RawStr) -> Result<NaiveDate, &'v RawStr> {
|
||||
match NaiveDate::parse_from_str(form_value, "%Y-%m-%d") {
|
||||
Ok(date) => Ok(date),
|
||||
Err(_) => Err(form_value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_pickup_times(
|
||||
street: Street,
|
||||
number: u64,
|
||||
|
|
Loading…
Reference in New Issue