Hey everyone! ![]()
I made an actor that runs periodically. It works just fine but now I want to call an async function from inside of closure:
struct MyActor;
impl Actor for MyActor {
type Context = Context<Self>;
fn started(&mut self, ctx: &mut Self::Context) {
ctx.run_interval(Duration::from_millis(100), |_this, _ctx| {
two().await;
});
}
}
async fn two() -> i32 {
2
}
How can I accomplish this?