use foxtive_cron::{Cron, CronResult};
#[tokio::main]
async fn main() {
let mut cron = Cron::new();
cron.add_job_fn(
"async-hello-job", "Inline Hello Job", "*/1 * * * * * *", async_runner,
)
.expect("Failed to add job");
cron.add_blocking_job_fn(
"heavy-task", "Heavy Task", "*/2 * * * * * *", blocking_runner,
)
.expect("Failed to add job");
cron.run().await;
}
async fn async_runner() -> CronResult<()> {
println!("Hello from async fn job at {}", chrono::Utc::now());
Ok(())
}
fn blocking_runner() -> CronResult<()> {
println!("Hello from blocking fn job at {}", chrono::Utc::now());
Ok(())
}