use crate::places::place_autocomplete::response::matched_substring::MatchedSubstring;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct StructuredFormat {
#[serde(alias = "main_text")]
pub main_text: String,
#[serde(alias = "main_text_matched_substrings")]
#[serde(default)]
pub main_text_matched_substrings: Vec<MatchedSubstring>,
#[serde(alias = "secondary_text")]
pub secondary_text: String,
#[serde(alias = "secondary_text_matched_substrings")]
#[serde(default)]
pub secondary_text_matched_substrings: Vec<MatchedSubstring>,
}
impl std::str::FromStr for StructuredFormat {
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)
} }