use crate::places::place_autocomplete::response::{
matched_substring::MatchedSubstring, structured_format::StructuredFormat, term::Term,
}; use crate::types::PlaceType;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct Prediction {
#[serde(alias = "description")]
pub description: String,
#[serde(alias = "matched_substrings")]
#[serde(default)]
pub matched_substrings: Vec<MatchedSubstring>,
#[serde(alias = "structured_formatting")]
pub structured_formatting: StructuredFormat,
pub distance_meters: Option<u64>,
#[serde(alias = "terms")]
#[serde(default)]
pub terms: Vec<Term>,
#[serde(alias = "place_id")]
pub place_id: Option<String>,
#[serde(alias = "types")]
#[serde(default)]
pub types: Vec<PlaceType>,
}
impl std::str::FromStr for Prediction {
type Err = serde_json::error::Error;
fn from_str(s: &str) -> Result<Self, serde_json::error::Error> {
serde_json::from_str(s)
} }