Make update callback send and sync

This commit is contained in:
hodasemi 2023-10-04 11:25:47 +02:00
parent bd99facbf4
commit 5e996cd47d

View file

@ -38,7 +38,7 @@ pub struct Device {
sub_type: u16, sub_type: u16,
device_protocol_version: u8, device_protocol_version: u8,
updates: Vec<Box<dyn Fn(&HashMap<&'static str, AttributeValue>) -> Result<()>>>, updates: Vec<Box<dyn Fn(&HashMap<&'static str, AttributeValue>) -> Result<()> + Send + Sync>>,
token: [u8; 64], token: [u8; 64],
key: [u8; 32], key: [u8; 32],
@ -153,7 +153,7 @@ impl Device {
pub fn register_update<F>(mut self, f: F) -> Self pub fn register_update<F>(mut self, f: F) -> Self
where where
F: Fn(&HashMap<&'static str, AttributeValue>) -> Result<()> + 'static, F: Fn(&HashMap<&'static str, AttributeValue>) -> Result<()> + Send + Sync + 'static,
{ {
self.updates.push(Box::new(f)); self.updates.push(Box::new(f));