siafu/
lib.rs

1//! # Siafu
2//! 
3//! An ergonomic job scheduling library for Rust.
4//! 
5//! ## Features
6//! 
7//! - Schedule tasks to run on specific dates/times
8//! - Set up recurring intervals (hourly, daily, weekly, monthly)
9//! - Schedule jobs using cron expressions for complex patterns
10//! - Run jobs at random times within a specified range
11//! - Set limits on recurring jobs
12//! - Error handling and job monitoring capabilities
13//! - Fluent builder API for easy job configuration
14//! 
15//! # Examples
16//!
17//! Basic usage:
18//!
19//! ```rust
20//! use siafu::{JobBuilder, ScheduleTime, SchedulerError};
21//! use std::time::{Duration, SystemTime};
22//!
23//! fn main() -> Result<(), SchedulerError> {
24//!     // One-off job after 5 seconds
25//!     let mut job = JobBuilder::new("example_once")
26//!         .once(ScheduleTime::Delay(Duration::from_secs(5)))
27//!         .add_handler(|| println!("Hello after delay!"))
28//!         .build();
29//!
30//!     // Recurring job every 10 seconds
31//!     let _recurring = JobBuilder::new("example_recurring")
32//!         .every(Duration::from_secs(10), None)
33//!         .add_handler(|| println!("Recurring task"))
34//!         .build();
35//!
36//!     // Cron-based job
37//!     let _cron = JobBuilder::new("example_cron")
38//!         .cron("0 0 * * * * *")
39//!         .add_handler(|| println!("Hourly task on the hour"))
40//!         .build();
41//!
42//!     // Run the one-off job
43//!     job.run()?;
44//!     Ok(())
45//! }
46//! ```
47
48pub mod job;
49pub mod scheduler;
50pub mod error;
51pub mod utils;
52
53pub use job::JobBuilder;
54pub use scheduler::*;
55pub use utils::time::{ScheduleTime, ScheduleTimeError};
56pub use error::Error as SchedulerError;
57/// Current version of the Siafu library
58pub const VERSION: &str = env!("CARGO_PKG_VERSION");