Skip to content

Commit 9b5efbb

Browse files
authored
Merge pull request #84 from kinode-dao/hf/match-caps-impls
match caps impls to core
2 parents 4631ebd + 69daa62 commit 9b5efbb

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "kinode_process_lib"
33
description = "A library for writing Kinode processes in Rust."
4-
version = "0.8.3"
4+
version = "0.8.4"
55
edition = "2021"
66
license-file = "LICENSE"
77
homepage = "https://kinode.org"

src/types/capability.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,20 @@ impl<'a> Deserialize<'a> for Capability {
153153
impl Hash for Capability {
154154
fn hash<H: Hasher>(&self, state: &mut H) {
155155
self.issuer.hash(state);
156-
self.params.hash(state);
156+
let params: serde_json::Value = serde_json::from_str(&self.params).unwrap_or_default();
157+
params.hash(state);
157158
}
158159
}
159160

160161
impl Eq for Capability {}
161162

162163
impl PartialEq for Capability {
163164
fn eq(&self, other: &Self) -> bool {
164-
self.issuer == other.issuer && self.params == other.params
165+
let self_json_params: serde_json::Value =
166+
serde_json::from_str(&self.params).unwrap_or_default();
167+
let other_json_params: serde_json::Value =
168+
serde_json::from_str(&other.params).unwrap_or_default();
169+
self.issuer == other.issuer && self_json_params == other_json_params
165170
}
166171
}
167172

0 commit comments

Comments
 (0)