-
I think this will get a negative answer, like in #5840, but if I don't care about knowing the result, just that the event was acted on, can I somehow wait on invoke_from_event_loop or other? or all the Or will I need to have an event counter and a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Would be indeed nice if invoke_from_event_loop could return a future or a handle like slint::spawn_local does. But this was implemented before and doesn't have this ability. So this can be implemented manually (assuming you are in a thread, if not, use spawn_local) let (tx, rx) = std::sync::mpsc::channel();
invoke_from_event_loop(move || {
// ... do stuff
tx.send(value).unwrap()
).unwrap();
let value = rx.recv().unwrap() Use a similar pattern with async channel from a crate if you want to use it with async rust. |
Beta Was this translation helpful? Give feedback.
Would be indeed nice if invoke_from_event_loop could return a future or a handle like slint::spawn_local does. But this was implemented before and doesn't have this ability.
So this can be implemented manually (assuming you are in a thread, if not, use spawn_local)
Use a similar pattern with async channel from a crate if you want to use it with async rust.