Add derives for standard traits
This commit is contained in:
parent
2380e35754
commit
44fba534b4
16
src/api.rs
16
src/api.rs
@ -15,7 +15,7 @@ pub struct Context {
|
|||||||
const API_BASE: &'static str = "https://api.easee.com/api/";
|
const API_BASE: &'static str = "https://api.easee.com/api/";
|
||||||
const REFRESH_TOKEN_DELAY: Duration = Duration::from_secs(600);
|
const REFRESH_TOKEN_DELAY: Duration = Duration::from_secs(600);
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone,Copy,Debug,Eq,Ord,PartialEq,PartialOrd)]
|
||||||
pub struct NaiveDateTime(pub chrono::NaiveDateTime);
|
pub struct NaiveDateTime(pub chrono::NaiveDateTime);
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for NaiveDateTime {
|
impl<'de> Deserialize<'de> for NaiveDateTime {
|
||||||
@ -29,7 +29,7 @@ impl<'de> Deserialize<'de> for NaiveDateTime {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Clone,Copy,Debug,Eq,Ord,PartialEq,PartialOrd)]
|
||||||
pub struct UtcDateTime(pub chrono::DateTime<chrono::Utc>);
|
pub struct UtcDateTime(pub chrono::DateTime<chrono::Utc>);
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for UtcDateTime {
|
impl<'de> Deserialize<'de> for UtcDateTime {
|
||||||
@ -44,7 +44,7 @@ impl<'de> Deserialize<'de> for UtcDateTime {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Clone,Debug,Deserialize,Eq,Ord,PartialEq,PartialOrd)]
|
||||||
#[serde(rename_all="camelCase")]
|
#[serde(rename_all="camelCase")]
|
||||||
pub struct Charger {
|
pub struct Charger {
|
||||||
pub id: String,
|
pub id: String,
|
||||||
@ -56,7 +56,7 @@ pub struct Charger {
|
|||||||
pub level_of_access: u32,
|
pub level_of_access: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize_repr, Debug)]
|
#[derive(Clone,Copy,Debug,Deserialize_repr,Eq,Ord,PartialEq,PartialOrd)]
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
pub enum ChargerOpMode {
|
pub enum ChargerOpMode {
|
||||||
Zero = 0,
|
Zero = 0,
|
||||||
@ -65,7 +65,7 @@ pub enum ChargerOpMode {
|
|||||||
Charging = 3,
|
Charging = 3,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Clone,Debug,Deserialize,PartialEq,PartialOrd)]
|
||||||
#[serde(rename_all="camelCase")]
|
#[serde(rename_all="camelCase")]
|
||||||
pub struct ChargerState {
|
pub struct ChargerState {
|
||||||
pub smart_charging: bool,
|
pub smart_charging: bool,
|
||||||
@ -139,7 +139,7 @@ pub struct ChargerState {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug,Deserialize)]
|
#[derive(Clone,Debug,Deserialize,PartialEq,PartialOrd)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ChargingSession {
|
pub struct ChargingSession {
|
||||||
pub charger_id: Option<String>,
|
pub charger_id: Option<String>,
|
||||||
@ -166,7 +166,7 @@ pub struct Address {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug,Deserialize)]
|
#[derive(Clone,Debug,Deserialize,Eq,Ord,PartialEq,PartialOrd)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Site {
|
pub struct Site {
|
||||||
pub uuid: Option<String>,
|
pub uuid: Option<String>,
|
||||||
@ -178,7 +178,7 @@ pub struct Site {
|
|||||||
pub installer_alias: Option<String>
|
pub installer_alias: Option<String>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug)]
|
#[derive(Clone,Debug,Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct LoginResponse {
|
pub struct LoginResponse {
|
||||||
pub access_token: String,
|
pub access_token: String,
|
||||||
|
Loading…
Reference in New Issue
Block a user