[#13] small changes
parent
e4b8be3ba3
commit
edc3605770
|
@ -45,7 +45,8 @@ pub fn get_pickup_times(
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|m| m.contains_key("date") && m.contains_key("label"))
|
.filter(|m| m.contains_key("date") && m.contains_key("label"))
|
||||||
{
|
{
|
||||||
// Because we filtered the maps in the loop, we can safely us unwrap here
|
// Because we filtered the maps in the loop, we can safely use unwrap
|
||||||
|
// here
|
||||||
if let Ok(date) = BasicDate::try_from(map.get("date").unwrap().as_str()) {
|
if let Ok(date) = BasicDate::try_from(map.get("date").unwrap().as_str()) {
|
||||||
output.push(PickupTime::new(date, map.get("label").unwrap().to_string()))
|
output.push(PickupTime::new(date, map.get("label").unwrap().to_string()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,6 @@ use std::convert::TryFrom;
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub struct BasicDate(pub DateTime<Tz>);
|
pub struct BasicDate(pub DateTime<Tz>);
|
||||||
|
|
||||||
/// This allows us to use BasicDate as a query parameter in our routes.
|
|
||||||
impl<'v> FromFormValue<'v> for BasicDate {
|
impl<'v> FromFormValue<'v> for BasicDate {
|
||||||
type Error = &'v RawStr;
|
type Error = &'v RawStr;
|
||||||
|
|
||||||
|
@ -25,7 +24,6 @@ impl<'v> FromFormValue<'v> for BasicDate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This is used to serialize BasicDate.
|
|
||||||
impl TryFrom<&str> for BasicDate {
|
impl TryFrom<&str> for BasicDate {
|
||||||
type Error = FejError;
|
type Error = FejError;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue