Compare commits

...

3 commits

Author SHA1 Message Date
hodasemi 4c0f6ea0f3 Merge pull request 'Update Rust crate futures to 0.3.29' (#13) from renovate/rust-futures-monorepo into master
Reviewed-on: #13
2023-10-31 11:17:47 +01:00
hodasemi 47aab2fc75 Fix equality check
All checks were successful
Home Server Merge / Serial Reader (pull_request) Successful in 19m56s
2023-10-30 06:49:59 +01:00
RenovateBot b21c89c81c Update Rust crate futures to 0.3.29
Some checks failed
Home Server Merge / Serial Reader (pull_request) Failing after 20m36s
2023-10-27 02:02:18 +02:00
2 changed files with 16 additions and 2 deletions

View file

@ -11,7 +11,7 @@ anyhow = { version = "1.0.75", features = ["backtrace"] }
reqwest = "0.11.22" reqwest = "0.11.22"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
futures = "0.3.28" futures = "0.3.29"
tokio = { version = "1.33.0", features=["macros", "rt-multi-thread"] } tokio = { version = "1.33.0", features=["macros", "rt-multi-thread"] }
tibber = "0.5.0" tibber = "0.5.0"
chrono = "0.4.31" chrono = "0.4.31"

View file

@ -44,7 +44,7 @@ impl FromStr for ActionType {
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct ActionID(pub(crate) i64); pub struct ActionID(pub(crate) i64);
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize)] #[derive(Debug, Clone, Eq, PartialOrd, Ord, Serialize)]
pub struct Action { pub struct Action {
#[serde(skip)] #[serde(skip)]
pub(crate) id: Option<ActionID>, pub(crate) id: Option<ActionID>,
@ -70,6 +70,20 @@ impl Action {
} }
} }
impl PartialEq for Action {
fn eq(&self, other: &Self) -> bool {
let id_comp = match (self.id, other.id) {
(Some(self_id), Some(other_id)) => self_id == other_id,
_ => true,
};
id_comp
&& self.device_id == other.device_id
&& self.action_type == other.action_type
&& self.parameter == other.parameter
}
}
#[derive(Debug, Default, Clone, PartialEq, Eq, Serialize)] #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize)]
pub struct ActionSet { pub struct ActionSet {
actions: Vec<Action>, actions: Vec<Action>,