Skip to navigation
Call from the egui to an async functions
20.08.24
# declare ```rust use tokio::runtime::Runtime; ``` ## Inside impl MyEguiApp ```rust fn perform(log_lines: String, ctx: egui::Context) -> Result<(), Box
> { tokio::spawn(async move { let config = get_config(); println!("...perform"); save_all_server_design(&config).await; }); Ok(()) } ``` ## The Caller Fuction from a Egui button ```rust if ui.button("Perform").clicked() { MyEguiApp::perform(self.log_lines.clone(), ctx.clone()); } ```
https://github.com/veto8/egui-tokio-example/blob/main/src/main.rs
Reply
Anonymous
Information Epoch 1741903647
Using text data files.
Home
Notebook
Contact us