slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.54k stars 600 forks source link

How can i use async fn #1769

Closed xiaodusx1 closed 2 years ago

xiaodusx1 commented 2 years ago

I need a login page.like this: main_window.on_login( move|user,password|{ let result=server.login(user,password).await?})

I use tokio::spawn,but it's too tremble.

Have a easy way to do it?

ogoffart commented 2 years ago

We should offer API to run future in the Slint event loop. This is already tracked in #757.

This comment explain a way to do it in the mean time: https://github.com/slint-ui/slint/issues/747#issuecomment-995769853

Closing as duplicate of #757