Skip to main content

Crate cronspeak

Crate cronspeak 

Source
Expand description

§cronspeak — say cron out loud

Convert cron expressions into clear, human-readable English, the way cronstrue (JavaScript) and cron-descriptor (Python) do.

assert_eq!(
    cronspeak::describe("0 9 * * 1-5").unwrap(),
    "At 09:00 AM, Monday through Friday"
);
assert_eq!(cronspeak::describe("*/15 * * * *").unwrap(), "Every 15 minutes");
assert_eq!(cronspeak::describe("@daily").unwrap(), "At 12:00 AM");

Pure logic, zero dependencies, #![no_std] (needs only alloc).

§Supported syntax

Standard 5-field cron (minute hour day-of-month month day-of-week) with *, single values, lists (a,b), ranges (a-b), and steps (*/n, a-b/n, a/n). Month and day-of-week accept names (JANDEC, SUNSAT, case-insensitive). The macros @yearly/@annually, @monthly, @weekly, @daily/@midnight, and @hourly are also recognized.

Structs§

Options
Options controlling how a cron expression is described.

Enums§

CronError
An error produced while parsing a cron expression.
TimeFormat
Clock style used when rendering times of day.

Functions§

describe
Describe a cron expression in human-readable English using default options.
describe_with
Describe a cron expression using the given Options.