cron

A cron expression parser and schedule explorer for Rust

Library
Cargo
v0.17.0
449 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
46 /100 Fair
Development Activity 16
Maintenance 20
Community 68
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
70 /100 Good
Architecture 75
Code Quality 72
Innovation 55
Learning Curve 78

cron is a Rust crate that parses standard six/seven-field cron expressions (seconds, minutes, hours, day-of-month, month, day-of-week, and an optional year field) into a Schedule type, then lets callers iterate over upcoming or past fire times using chrono’s timezone-aware DateTime. It supports the full cron grammar — ranges, lists, steps, and named months/weekdays — without requiring a running scheduler.

Because it only computes fire times rather than executing jobs itself, it is typically paired with an application’s own timer loop or task runner, making it a building block for job schedulers, monitoring tools that need to know when a cron-defined task is due, and CLIs that validate or explain cron expressions.

What You Get

  • A Schedule type parsed via FromStr from six- or seven-field cron expressions
  • schedule.upcoming(tz) and schedule.after(&datetime) iterators returning chrono::DateTime values in any timezone
  • Support for ranges, comma-separated lists, step values (*/2), and named months/weekdays (Mon, May) in expressions
  • An optional serde feature for serializing/deserializing Schedule values
  • Structured error types (error module) for invalid expressions

Common Use Cases

  • Computing the next N run times for a cron-defined job inside a custom task scheduler or worker loop
  • Validating and explaining user-supplied cron expressions in an admin UI or CLI tool
  • Driving background job systems that need to check whether a scheduled task’s fire time has passed
  • Monitoring/alerting tools that compare a job’s actual run against its expected cron schedule

Under The Hood

Architecture - The crate separates parsing from scheduling: parsing.rs (686 lines) implements the cron-expression grammar using the winnow parser-combinator library, producing intermediate specifier.rs/ordinal.rs representations; schedule.rs (1063 lines) then owns the Schedule type and its upcoming()/after() iterator logic, delegating field-specific range/step semantics to per-unit modules under src/time_unit/ (seconds, minutes, hours, days_of_month, months, days_of_week, years), each implementing a shared trait from time_unit/mod.rs. queries.rs and error.rs round out query helpers and error types.

Tech Stack - Built on chrono for timezone-aware datetime arithmetic, winnow for expression parsing, once_cell for lazy statics, and phf for compile-time perfect-hash maps (used for named month/weekday lookup tables). An optional serde feature (with postcard and serde_test as dev-dependencies) adds serialization support without imposing it on default users.

Code Quality - Testing lives in tests/lib.rs alongside inline unit tests across the time_unit and parsing modules, exercising round-trip parsing and iteration correctness; #![deny(rust_2018_idioms)] and #![deny(rustdoc::broken_intra_doc_links)] are enforced at the crate root. The crate has shipped 11 tagged releases since 2015 with steady, if infrequent, maintenance and 32 contributors, and CI runs via GitHub Actions.

API Design - The primary entry point, Schedule::from_str(expr), mirrors idiomatic Rust parsing conventions, and the resulting iterators (upcoming(tz), after(&dt)) compose naturally with chrono and standard iterator adapters like .take(n). The crate root doc comment demonstrates the full usage flow in a single runnable example, keeping the barrier to a first working schedule low.

Used by 5 apps in this directory

TypeScript
54%
MIT

Anarlog

AI Assistants · Note Taking · Productivity

9,404

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
68
Dependency
Built with
TypeScript 54%
Rust 34%
Updated 1 weeks ago
Rust
73%
Other

iii

Developer Tools · Devops

18,814

Compose, extend, and observe every backend service in real time using three primitives: Workers, Functions, and Triggers.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 73%
TypeScript 16%
Updated 1 weeks ago
Rust
89%
Apache 2.0

OpenFang

AI Agents

18,210

An open-source "Agent Operating System" built in Rust — a single binary providing a kernel, memory, skills, extensions, and multi-channel runtime for running AI agents, with 1,700+ tests and zero clippy warnings.

View details
52
Repo Health
73
Technical
68
Dependency
Built with
Rust 89%
Updated 3 months ago
Rust
93%
Other

Tabby

AI Code Assistants

33,892

Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.

View details
58
Repo Health
78
Technical
61
Dependency
Built with
Rust 93%
Updated 3 months ago
Rust
64%
Apache 2.0

Temps

Analytics · Devops · Monitoring

801

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
70
Dependency
Built with
Rust 64%
TypeScript 34%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers