Replies: 1 comment 2 replies
-
I'm not sure what the config callback does. But it looks like it could be a problem if it is called several times. Do you really want to start several event loop? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm using Slint as a front-end UI with Rust, with a backend event loop using tokio. I'm new to Slint, but have some experience with Rust and concurrency.
I want to kick off the tokio event loop from a button in the UI, but I also want to communicate from the UI to the tokio loop while the latter is running. The typical way I'd do this is with a tokio channel, but when I try to do this, I run into ownership/copying issues passing the receive end of the channel to the backend. Here's what my code looks like:
This gives me an error,
error[E0507]: cannot move out of 'rx', a captured variable in an 'FnMut' closure
, which makes sense since I'm doing a "move" (although I wish there was a way to claim ownership of the variable in the closure, but 🤷).My question is: is this the "canonical" way to do this? Is there a better way to send information from the UI thread back to the backend event loop? This all works fine if I don't trigger it from a UI callback, but I need some way of passing the initial values to the backend from a UI dialog.
Thanks for any help,
-Jack
Beta Was this translation helpful? Give feedback.
All reactions