fache 0.1.351

发车工具箱
Documentation
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct WeatherResponse {
    pub status: i32,
    pub message: String,
    pub result: WeatherResult,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct WeatherResult {
    #[serde(default)]
    pub realtime: Vec<RealtimeWeather>,
    #[serde(default)]
    pub forecast: Vec<ForecastWeather>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RealtimeWeather {
    pub province: String,
    pub city: String,
    pub district: String,
    pub adcode: i32,
    #[serde(rename = "update_time")]
    pub update_time: String,
    pub infos: RealtimeInfo,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RealtimeInfo {
    pub weather: String,
    pub temperature: f32,
    #[serde(rename = "wind_direction")]
    pub wind_direction: String,
    #[serde(rename = "wind_power")]
    pub wind_power: String,
    pub humidity: f32,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ForecastWeather {
    pub province: String,
    pub city: String,
    pub district: String,
    pub adcode: i32,
    #[serde(rename = "update_time")]
    pub update_time: String,
    pub infos: Vec<ForecastInfo>,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct ForecastInfo {
    pub date: String,
    pub week: String,
    pub day: DayNightInfo,
    pub night: DayNightInfo,
}

#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct DayNightInfo {
    pub weather: String,
    pub temperature: f32,
    #[serde(rename = "wind_direction")]
    pub wind_direction: String,
    #[serde(rename = "wind_power")]
    pub wind_power: String,
    pub humidity: f32,
}