Expressive Cron
A fluent builder for cron expressions, inspired by Laravel.
Features
- Fluent Builder: Chain frequency helpers (
daily,hourly_at,weekdays,every_five_minutes, …) to build a cron expression without thinking about field positions. - Type-Safe Days: Use the
DayOfWeekenum instead of stringly-typed numerics —cron.days(DayOfWeek::Monday)instead ofcron.days("1"). - Polymorphic Fields: Methods accept any
impl IntoCronValue, sohourly_at(37),hourly_at("*/10"), andhourly_at([15, 30, 45])all work. - Filter Hooks: Attach arbitrary closures with
when/skip, or use built-in time-of-day windows viabetween/unless_between. - Timezone-Aware: Time-based filters are evaluated in a configurable
chrono_tz::Tz.
Usage
use ;
let mut cron = new;
cron.every_five_minutes
.between
.weekdays;
assert_eq!;
assert!; // true when called inside the window on a weekday
let mut nightly = new;
nightly.hourly_at.days;
assert_eq!;
Please refer to the documentation on docs.rs for detailed usage instructions.
License
This project is licensed under the MIT License - see the LICENSE file for details.