I assume you’ve fixed this at this point, but the idea is you return Tasks to the runtime and let it execute them.
Task::perform(my_async_fn(), Message::ActionGesture) is the way to use it, assuming my_async_fn() returns type T and Message looks like:
pub enum Message {
ActionGesture(T)
}
That T can be whatever you want, so long as they match. If T is (), then just make it
pub enum Message {
ActionGesture
}
I think that ought to work
You could also Task::future(my_async_fn()).map(Message::ActionGesture)
A couple more examples here: How to use "and_then" with Task - #2 by airstrike