This is my current Rust code
async fn test() {
........
loop {
......
set_timeout(Duration::from_secs(5)).await;
}
}
I want to make my function synchronous, can I do something like ...
fn test() {
loop {
async {
......
set_timeout(Duration::from_secs(5)).await;
}
}
}
I tried something as shown above, I removed async keyword from the function and created an async block inside loop, but after this changes, my code somehow becomes unreachable,
How can I keep my "test" function synchronous and still make my code reachable?!
asynctosync, the contrary is not possible