| Crates.io | relayr |
| lib.rs | relayr |
| version | 0.4.0 |
| created_at | 2025-04-25 17:23:54.367824+00 |
| updated_at | 2025-05-01 21:18:29.192052+00 |
| description | Cron scheduler with a delegated-flavour syntax |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1649261 |
| size | 45,198 |
🏃♂️ Effortless delegated cron jobs — scheduled tasks in Rust, made simple.
relayr makes it easy to register cron jobs across your codebase without manual boilerplate. Just annotate functions with a macro, and relayr will auto-discover and schedule them at runtime!
This crate is a wrapper around async-cron-scheduler to use it in a delegated flavour. If you aren't looking for the delegated way of defining your cron jobs it's probably better for you to use that.
⸻
✅ Register cron jobs with a simple macro
✅ Fully async
✅ No need to manually wire up each job
✅ Registration happens at compile time thanks to inventory
✅ Validates cron patterns at compile time
⸻
Add to your Cargo.toml:
relayr = "0.4.0"
This will bring in the core scheduler, inventory, and macro support.
⸻
use relayr::prelude::*;
use chrono::Local;
#[relayr::cron("1/1 * * * * *")]
async fn print_every_second(_: JobId) -> anyhow::Result<()> {
println!("🖤 Hello from relayr 0.4.0!");
Ok(())
}
#[tokio::main]
async fn main() {
relayr::run::<Local>().await
}
When relayr::run() starts, it automatically picks up all functions decorated with #[relayr::cron(...)] and schedules them.
⸻
#[relayr::cron("cron pattern")].relayr::run() is called:
No manual wiring. No giant match blocks. Just clean, delegated jobs.
⸻
📦 Crate: https://crates.io/crates/relayr
🛠️ Repo: https://github.com/dsplce-co/relayr
PRs welcome! Let’s make scheduled Rust ✨clean and effortless.
⸻
MIT or Apache-2.0, at your option.