Avoid unnecessary item paths

This commit is contained in:
Xiretza 2024-02-02 15:27:17 +00:00
parent 7d42a56199
commit 5ec9079456

View file

@ -1,6 +1,6 @@
use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde_repr::{Deserialize_repr, Serialize_repr}; use serde_repr::{Deserialize_repr, Serialize_repr};
use std::net::IpAddr; use std::{collections::HashMap, net::IpAddr};
use thiserror::Error; use thiserror::Error;
#[derive(Debug, Error)] #[derive(Debug, Error)]
@ -54,7 +54,7 @@ pub struct Status {
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")] #[serde(rename_all = "PascalCase")]
pub struct CommonResponseHeader { pub struct CommonResponseHeader {
request_arguments: std::collections::HashMap<String, String>, request_arguments: HashMap<String, String>,
status: Status, status: Status,
#[serde(with = "time::serde::rfc3339")] #[serde(with = "time::serde::rfc3339")]
timestamp: time::OffsetDateTime, timestamp: time::OffsetDateTime,
@ -77,7 +77,7 @@ pub struct CommonResponseBody<T> {
#[serde(rename_all = "PascalCase")] #[serde(rename_all = "PascalCase")]
pub struct UnitAndValues<T> { pub struct UnitAndValues<T> {
unit: String, unit: String,
values: std::collections::HashMap<String, T>, values: HashMap<String, T>,
} }
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
@ -133,7 +133,7 @@ pub struct CumulationInverterData {
year_energy: UnitAndValue<f64>, year_energy: UnitAndValue<f64>,
total_energy: UnitAndValue<f64>, total_energy: UnitAndValue<f64>,
#[serde(rename = "DeviceStatus")] #[serde(rename = "DeviceStatus")]
device_status: Option<std::collections::HashMap<String, serde_json::Value>>, device_status: Option<HashMap<String, serde_json::Value>>,
} }
impl DataCollection for CumulationInverterData { impl DataCollection for CumulationInverterData {