https://git.sr.ht/~azdle/nex-trip-gtk/tree/c8f04fcd933d9ddeeec47176e59db8e48efd8abd/src/main.rs
I'm doing some experimenting with melding together gtk-rs & tokio. What I have so far is in the link above. But I've got a few questions about how to improve it.
Basically what I have now is two different threads, one for gtk and one for tokio, and an mpsc channel for data flowing in each direction.
What I have works, but there's a few things that are less than ergonomic. (Also, I'm aware of things like relm and vgtk that might be helpful, but I'm trying to work at a lower level for learning and in the end I'm not sure I want to be dependent on too many incomplete libraries.)
The biggest known problem is this data type: ~azdle/nex-trip-gtk: src/main.rs - sourcehut git I need the values passed into build_ui
to be Clone
, but mpsc::Receiver
isn't. I think the way to solve this is to just handle all the main thread futures setup stuff before calling Application::run()
, but with that I don't know how to get then get access to the widgets in the futures.
Definitely also interested in other general feedback about the overall idea.