Running scheduled cron jobs in Rust using tokio

Running periodic/scheduled tasks in Rust using tokio and async/await

One common use case when writing backend services is to have the feature to perform some task on a periodic/scheduled manner.

The following code can be used to perform some task on a period manner, using tokio and async/await

let mut interval = time::interval(std::time::Duration::from_secs(60));

loop {
    tokio::spawn(async { perform_task().await; });