How to combine egui with tokio/async code?

This is a discussion from egui, which started one year ago.
I'm not familiar with GUI programming or async code. And I get four patterns from that discussion:

  • Use a thread to run tokio runtime, and the runtime spawns async tasks, like this. But this approch seems to run tasks only in that function.
  • Use a thread to run tokio runtime globally, and call tokio::spawn whenever an async task is required. Like this: it looks good.
  • Run egui on tokio runtime, like this.
  • Carry the tokio runtime in the top struct which is implemented with ::eframe::App trait, like this.

I have no idea which design is the best and how good or bad they are.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.