hron (Rust)
Native Rust implementation of hron — human-readable cron expressions.
Install
By default, serde support is included. For a minimal build with only jiff as a dependency:
[]
= { = "*", = false }
Usage
use Schedule;
use Zoned;
// Parse an expression
let schedule: Schedule = "every weekday at 9:00 in America/New_York".parse.unwrap;
// Compute next occurrence
let now = now;
let next = schedule.next_from;
// Compute next N occurrences
let next_five = schedule.next_n_from;
// Check if a datetime matches
let matches = schedule.matches;
// Convert to cron (expressible subset only)
let cron = parse.unwrap.to_cron.unwrap;
// Convert from cron
let from_cron = from_cron.unwrap;
// Canonical string (roundtrip-safe)
println!;
Tests
Conformance tests driven by spec/tests.json.
License
MIT