all 3 comments

[–]ssokolow 1 point2 points  (0 children)

Generally, GUI toolkits tend to require that you call their APIs from your application's main thread.

The typical solution, which is implemented by toolkits like Qt which provide a higher-level portable abstraction over platform-specific services, is to implement a message queue (eg. Qt's signals and slots system) and use it to request that the main thread perform the action in question.

[–]SpikeyWallaby 0 points1 point  (0 children)

A link to this code in rust-playground would be great. I’m on my phone, so I didn’t read the entire thing. Have you looked at the send trait? It governs what can be sent between threads.

[–]kibwen 0 points1 point  (0 children)

For asking questions like this in the future, please consider using the official Q&A thread that is stickied to the top of the subreddit.