| Crates.io | armature-cron |
| lib.rs | armature-cron |
| version | 0.1.1 |
| created_at | 2025-12-26 22:38:38.594112+00 |
| updated_at | 2025-12-29 00:50:30.720904+00 |
| description | Scheduled task execution for Armature applications |
| homepage | https://pegasusheavy.github.io/armature |
| repository | https://github.com/pegasusheavy/armature |
| max_upload_size | |
| id | 2006366 |
| size | 89,880 |
Cron job scheduling for the Armature framework.
[dependencies]
armature-cron = "0.1"
use armature_cron::CronScheduler;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let scheduler = CronScheduler::new();
// Run every minute
scheduler.add("cleanup", "* * * * *", || async {
println!("Running cleanup...");
Ok(())
})?;
// Run daily at midnight
scheduler.add("daily_report", "0 0 * * *", || async {
generate_report().await
})?;
// Run every Monday at 9am
scheduler.add("weekly_email", "0 9 * * MON", || async {
send_weekly_digest().await
})?;
scheduler.start().await?;
Ok(())
}
┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, Sun=0)
│ │ │ │ │
* * * * *
MIT OR Apache-2.0