Skip to content

v1.0.0

Choose a tag to compare

@Hexagon Hexagon released this 30 Nov 19:58
· 163 commits to main since this release

Release Notes for Croner (Rust) - Version 1.0.0

Initial Stable Release

Introducing crate croner version 1.0.0 - a fully featured, lightweight and efficient Rust library for parsing and evaluating cron patterns.

Key Features:

  • Parse and evaluate cron expressions.
  • Follows Vixie/POSIX-cron standards, and extends it with L, #, W and optional second granularity.
  • Time zone support (chrono and chrono-tz compatible).
  • Robust error handling.
  • Nickname patterns: @yearly, @monthly, @weekly, @daily, @hourly.
  • Iterators for easy iteration over upcoming occurrences.
  • Built with performance and simplicity in mind.
  • MIT Licensed.

Why Croner instead of Cron or Saffron?.

Usage Example showcasing is_time_matching, find_next_occurrence and iter_from:

use croner::Cron;
use chrono::Local;

// Example: Parse cron expression
let cron: Cron = "0 18 * * * FRI".parse().expect("Couldn't parse cron string");

// Example: Compare cron pattern with current local time
let time = Local::now();
let matches = cron.is_time_matching(&time).unwrap();

// Example: Get next match
let next = cron.find_next_occurrence(&time, false).unwrap();

// Output results
println!("Current time is: {}", time);
println!("Pattern \"{}\" does {} time {}", cron.pattern.to_string(), if matches { "match" } else { "not match" }, time );
println!("Pattern \"{}\" will match next time at {}", cron.pattern.to_string(), next);

// Example: Iterator
println!("Next 5 matches:");
for time in cron.clone().iter_from(Local::now()).take(5) {
    println!("{}", time);
}

For detailed usage and API documentation, visit Croner on docs.rs and check out the README.