aboutsummaryrefslogtreecommitdiff
path: root/src/item_update.rs
diff options
context:
space:
mode:
authorLibravatar daniloaz <daniloaz@gmail.com>2024-04-13 12:21:12 +0200
committerLibravatar daniloaz <daniloaz@gmail.com>2024-04-13 12:21:12 +0200
commit5af8a69942aeed85b5cd2bd84cb5f33169834690 (patch)
treed3910ffc83037fd931d665112b076070f01b9295 /src/item_update.rs
parent82a9d2f0708c7f3754d5c40a60fa291bb320301b (diff)
✨ (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
Diffstat (limited to 'src/item_update.rs')
-rw-r--r--src/item_update.rs6
1 files changed, 3 insertions, 3 deletions
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<String>,
pub item_pos: usize,
pub fields: HashMap<String, Option<String>>,
- pub changed_fields: HashMap<String, Option<String>>,
+ pub changed_fields: HashMap<String, String>,
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<String, Option<String>> {
+ pub fn get_changed_fields(&self) -> HashMap<String, String> {
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<usize, Option<String>> {
+ pub fn get_changed_fields_by_position(&self) -> HashMap<usize, String> {
self.changed_fields
.iter()
.map(|(name, value)| (self.get_field_position(name), value.clone()))