Croner (Rust Edition)
Work in progress
Croner is a lightweight, efficient Rust library for parsing and handling cron patterns. Designed with simplicity and performance in mind, it provides Rust developers with a tool to schedule tasks efficiently, following the familiar cron syntax.
This is the Work in progress Rust flavor of the popular JavaScript/TypeScript cron scheduler croner.
Features
- Schedule and trigger functions using Cron syntax.
- Parse and evaluate cron expressions to calculate upcoming execution times.
- Supports extended Vixie-cron patterns with additional specifiers such as
L
for the last day and weekday of the month, and#
for the nth weekday of the month. - Manage scheduling across different time zones.
- Includes overrun protection to prevent jobs from overlapping in a concurrent environment.
- Robust error handling.
- Control execution flow with the ability to pause, resume, or stop scheduled tasks.
- Operates in-memory without the need for persistent storage or configuration files.
Getting Started
Prerequisites
Ensure you have Rust installed on your machine. If not, you can get it from the official Rust website.
Installation
Add croner
to your Cargo.toml
dependencies:
Please note that croner for Rust is work in progress, and not production ready
[]
= "0.0.1" # Adjust the version as necessary
Usage
Here's a quick example to get you started:
Note that this example will require you to add the chrono
crate
use CronPattern;
use CronScheduler;
use Local;
Development
To start developing in the Croner project:
- Clone the repository.
- Navigate into the project directory.
- Build the project using
cargo build
. - Run tests with
cargo test
. - Run demo with
cargo run --example pattern_demo
Contributing
We welcome contributions! Please feel free to submit a pull request or open an issue.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
Acknowledgments
- Thanks to the
chrono
crate for providing robust date and time handling in Rust. - This project adheres to Semantic Versioning.
Disclaimer
This is an early version of Croner, and the API is subject to change.
Contact
If you have any questions or feedback, please open an issue in the repository and we'll get back to you as soon as possible.