Processing values from signals (match_signal closure) #393
-
I am currently working with the org.freedesktop.PackageKit dbus api. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
After all I found a solution to get the data out of the closure using Arc and Mutex: // Note: Untested modification of the example
let result: Arc<Mutex<Vec<ComExampleDbustestHelloHappened>>> = Arc::new(Mutex::new(Vec::new()));
let result_2 = result.clone();
let _id = proxy.match_signal(|h: ComExampleDbustestHelloHappened, _: &Connection, _: &Message| {
println!("Hello happened from sender: {}", h.sender);
result_2.lock().unwrap().push(h);
true
});
println!("{:?}", result); |
Beta Was this translation helpful? Give feedback.
After all I found a solution to get the data out of the closure using Arc and Mutex: