I have the following problem:
I'm trying to call sync
closure from async
function, but sync closure
has to later call another async
function.
I cannot make async closure, because they are unstable at the moment:
error[E0658]: async closures are unstable
so I have to do it this way somehow.
I found a couple of questions related to the problem, such as this, but when I tried to implement it, im receiving the following error:
Cannot start a runtime from within a runtime.
This happens because a function (like `block_on`)
attempted to block the current thread while the
thread is being used to drive asynchronous tasks.'
here is playground link which hopefully can show what I'm having problem with.
I'm using tokio as stated in the title.
question from:https://stackoverflow.com/questions/65837485/rust-tokio-calling-async-function-from-sync-closure