You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a simplification of a current problem I'm having:
ui.on_pick(move || {
let path = slint::spawn_local(async move {
match pick_folder {
true => pick_save_folder().await, // These return std::path::PathBuf
false => pick_save_file().await, //
}
}).unwrap();
// stuff that needs `path`
});
path needs to be PathBuf, but it's actually JoinHandle<PathBuf> and since ui.on_pick()'s closure isn't async, I can't use await.
I could move the rest of the code inside the spawn_local block but that seems a bit messy since it needs to go on to spawn other threads and the like. Since this is the only part of the handler that needs to be async, is there any way to await it without moving the rest of the code inside the block?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Here is a simplification of a current problem I'm having:
path
needs to bePathBuf
, but it's actuallyJoinHandle<PathBuf>
and sinceui.on_pick()
's closure isn't async, I can't use await.I could move the rest of the code inside the
spawn_local
block but that seems a bit messy since it needs to go on to spawn other threads and the like. Since this is the only part of the handler that needs to be async, is there any way to await it without moving the rest of the code inside the block?Beta Was this translation helpful? Give feedback.
All reactions