mod error_object;
mod error;
use crate::{
geolocation::response::error_object::ErrorObject,
latlng::LatLng,
}; use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct Response {
#[serde(default)]
pub location: Option<LatLng>,
#[serde(default)]
pub accuracy: Option<f64>,
#[serde(default)]
pub error: Option<ErrorObject>,
}
impl std::str::FromStr for Response {
type Err = serde_json::Error;
fn from_str(s: &str) -> Result<Self, serde_json::Error> {
let bytes = s.to_string().into_bytes();
serde_json::from_slice(&bytes)
}
}