Skip to main content

Module cron

Module cron 

Source
Expand description

Minimal cron-expression parser + recurring scheduler.

Accepts the classic 5-field syntax:

  minute  hour  day-of-month  month  day-of-week
  0-59    0-23  1-31          1-12   0-6 (Sunday=0)

Per field we support: * - every value in the field’s range */N - every Nth value (step from the field’s minimum) a-b - inclusive range a,b,c - explicit list (entries may be ranges or steps) a - single literal value

Not supported (out of scope for the minimum-viable recipe): the L/W/? extensions, named months/days, seconds field, and step modifiers attached to ranges (1-10/2). If a workload needs those, reach for a full-featured cron crate.

CronSchedule::next_after(epoch_seconds) returns the next firing second on or after the input. CronScheduler ties a CronSchedule to a base TimerWheel, re-arming the next deadline each time the current one fires.

Structs§

CronSchedule
CronScheduler
Recurring scheduler glued to a base TimerWheel. After each fire the scheduler computes the next deadline from the cron schedule and re-arms.

Enums§

CronError