cronitor/
lib.rs

1//! # Cronitor
2//! 
3//! Cronitor is a simple and efficient cron framework in Rust. It allows you to schedule and run cron jobs with ease.
4//! 
5//! !! ATTENTION !!
6//! YOU WILL NEED DEPENDENCIES as proc-macros can be funny sometimes.
7//! 
8//! ```toml
9//! cronitor = { git = "https://github.com/floris-xlx/cronitor.git", branch = "main" }
10//! cronitor_runtime = { git = "https://github.com/floris-xlx/cronitor.git", branch = "main" }
11//! ctor = "0.2.8"
12//! ```
13//! 
14//! 
15//! ## Examples
16//! 
17//! Here are some examples of how to use Cronitor:
18//! 
19//! ### Example 1: Run a job every minute
20//! 
21//! ```rust
22//! use cronitor_macro::cronitor;
23//! use cronitor_runtime::cron_runtime;
24//! 
25//! #[cronitor("*/1 * * * *")]
26//! fn ping_every_minute() {
27//!     println!("Ping! Pong!");
28//! }
29//! 
30//! fn main() {
31//!     cron_runtime();
32//!     
33//!     loop {
34//!         std::thread::park();
35//!     }
36//! }
37//! ```
38//! 
39//! ### Example 2: Run multiple jobs
40//! 
41//! ```rust
42//! use cronitor_macro::cronitor;
43//! use cronitor_runtime::cron_runtime;
44//! 
45//! #[cronitor("*/5 * * * *")]
46//! fn ping_every_5_minutes() {
47//!     println!("Ping! Pong!");
48//! }
49//! 
50//! #[cronitor("*/15 * * * *")]
51//! fn ping_every_15_minutes() {
52//!     println!("Ping! Pong! part 2");
53//! }
54//! 
55//! fn main() {
56//!     cron_runtime();
57//!     
58//!     loop {
59//!         std::thread::park();
60//!     }
61//! }
62//! ```
63//! 
64//! ### Example 3: Run a job every day at 6 AM
65//! 
66//! ```rust
67//! use cronitor_macro::cronitor;
68//! use cronitor_runtime::cron_runtime;
69//! 
70//! #[cronitor("0 6 * * *")]
71//! fn ping_every_day_at_6() {
72//!     println!("Ping! Pong!");
73//! }
74//! 
75//! fn main() {
76//!     cron_runtime();
77//!     
78//!     loop {
79//!         std::thread::park();
80//!     }
81//! }
82//! ```
83//! 
84//! ## Example files
85//! Example files can be found in /examples folder. You can run these examples using the following command:
86//! 
87//! [Examples folder](https://github.com/floris-xlx/cronitor/tree/main/examples)
88//! 
89//! ```sh
90//! cargo run --example EXAMPLE_FILE.rs
91//! ```
92//! 
93//! ## Timezone
94//! 
95//! Cronitor picks the timezone that the computer is in, ensuring that your cron jobs run according to the local time settings.
96//! 
97//! ## Synchronous Contexts
98//! 
99//! Cronitor is designed for synchronous contexts for now. This means that it is best suited for applications where tasks need to be executed in a sequential manner.
100//! 
101//! ## Verify Cron Expressions
102//! 
103//! If you want to verify a cron expression, you can use this website: [https://crontab.cronhub.io/](https://crontab.cronhub.io/)
104
105
106pub use cronitor_macro::cronitor;
107pub use cronitor_runtime::cron_runtime;
108