Function slint_interpreter::spawn_local
pub fn spawn_local<F>(
fut: F
) -> Result<JoinHandle<<F as Future>::Output>, EventLoopError>where
F: Future + 'static,
Expand description
Spawn a Future to run in the Slint event loop
Since the future isn’t sent, this function must only be run on the main Slint thread that runs the event loop.
And the event loop must have been initialized to be able to call this function.
If you have a Sent
future that you want to spawn form an other thread, call this function from a closure to
to invoke_from_event_loop
Example
slint::spawn_local(async move {
// code here that can await
}).unwrap();