From 5af8a69942aeed85b5cd2bd84cb5f33169834690 Mon Sep 17 00:00:00 2001 From: daniloaz Date: Sat, 13 Apr 2024 12:21:12 +0200 Subject: ✨ (Cargo.toml): Bump package version to 0.1.8 for new changes ♻️ (item_update.rs): Refactor ItemUpdate struct and related methods to store only non-null changed fields ♻️ (ls_client.rs): Refactor data update handling to store updates in a HashMap and call on_item_update for each listener 🐛 (ls_client.rs): Fix item index off-by-one error in data update handling 🐛 (main.rs): Update on_item_update implementation to handle new ItemUpdate structure ♻️ (subscription_listener.rs): Refactor on_item_update method to take a reference to ItemUpdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/item_update.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/item_update.rs') diff --git a/src/item_update.rs b/src/item_update.rs index 6c21882..7c43d93 100644 --- a/src/item_update.rs +++ b/src/item_update.rs @@ -28,7 +28,7 @@ pub struct ItemUpdate { pub item_name: Option, pub item_pos: usize, pub fields: HashMap>, - pub changed_fields: HashMap>, + pub changed_fields: HashMap, pub is_snapshot: bool, } @@ -46,7 +46,7 @@ impl ItemUpdate { /// /// # Returns /// A map containing the values for each field changed with the last server update. - pub fn get_changed_fields(&self) -> HashMap> { + pub fn get_changed_fields(&self) -> HashMap { self.changed_fields.clone() } @@ -60,7 +60,7 @@ impl ItemUpdate { /// /// # Returns /// A map containing the values for each field changed with the last server update. - pub fn get_changed_fields_by_position(&self) -> HashMap> { + pub fn get_changed_fields_by_position(&self) -> HashMap { self.changed_fields .iter() .map(|(name, value)| (self.get_field_position(name), value.clone())) -- cgit v1.2.3