google_maps 3.9.5

An unofficial Google Maps Platform client library for the Rust programming language.
Documentation
//! A photo of a Place. The photo can be accesed via the
/// [Place Photo](https://developers.google.com/places/web-service/photos) API
/// using a URL.
use serde::{Deserialize, Serialize};

// -----------------------------------------------------------------------------
//
/// A photo of a Place. The photo can be accesed via the
/// [Place Photo](https://developers.google.com/places/web-service/photos) API
/// using an url in the following pattern:
///
/// ```
/// https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photo_reference=photo_reference&key=YOUR_API_KEY
/// ```
///
/// See [Place Photos](https://developers.google.com/places/web-service/photos) for more information.
#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct PlacePhoto {
    /// The height of the photo.
    pub height: u16,
    /// The HTML attributions for the photo.
    #[serde(default)]
    pub html_attributions: Vec<String>,
    /// A string used to identify the photo when you perform a Photo request.
    pub photo_reference: String,
    /// The width of the photo.
    pub width: u16,
} // struct PlacePhoto

// -----------------------------------------------------------------------------

impl std::str::FromStr for PlacePhoto {
    type Err = serde_json::Error;
    /// Parse a Google Maps Places API JSON response into a usable
    /// `PlacePhoto` struct.
    fn from_str(s: &str) -> Result<Self, serde_json::Error> {
        let bytes = s.to_string().into_bytes();
        serde_json::from_slice(&bytes)
    } // fn from_str
} // impl FromStr