noaa_weather_client 0.1.3

A client library for the NOAA weather.gov API
Documentation
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct GeoJsonPolygon {
    #[serde(rename = "type")]
    pub r#type: Type,
    /// A GeoJSON polygon. Please refer to IETF RFC 7946 for information on the GeoJSON format.
    #[serde(rename = "coordinates")]
    pub coordinates: Vec<Vec<Vec<f64>>>,
    /// A GeoJSON bounding box. Please refer to IETF RFC 7946 for information on the GeoJSON format.
    #[serde(rename = "bbox", skip_serializing_if = "Option::is_none")]
    pub bbox: Option<Vec<f64>>,
}

impl GeoJsonPolygon {
    pub fn new(r#type: Type, coordinates: Vec<Vec<Vec<f64>>>) -> GeoJsonPolygon {
        GeoJsonPolygon {
            r#type,
            coordinates,
            bbox: None,
        }
    }
}

#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "Polygon")]
    Polygon,
}

impl Default for Type {
    fn default() -> Type {
        Self::Polygon
    }
}