Open tinou98 opened 1 month ago
This allows to write code like that :
struct NotificationHandler { buffer: Chunk, sender: Sender, } impl OnSubscriptionNotification for NotificationHandler { fn on_data_value(&mut self, val: DataValue, item: &MonitoredItem) { let Some(value) = val.value else { return; }; self.buffer.add_point(item.item_to_monitor().node_id, value); } fn on_packet_handled(&mut self) { self.sender.send(std::mem::take(&mut self.buffer)); } }
I didn't add the entry in SubscriptionCallbacks, because the main purpose of this “packet handled” event is to flush something, which require shared state (which is hard in different FnMut), and also because it would be a breaking change.
SubscriptionCallbacks
FnMut
This allows to write code like that :
I didn't add the entry in
SubscriptionCallbacks
, because the main purpose of this “packet handled” event is to flush something, which require shared state (which is hard in differentFnMut
), and also because it would be a breaking change.