Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_datime/src/schedule/mod.rs

1.9 KiB, 57 runs

created by r1870400018:8492, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1//! Scheduling and action management.
2//!
3//! This module provides comprehensive functionality for scheduling tasks,
4//! managing recurring events, and executing time-based actions.
5//!
6//! # Features
7//!
8//! - **Task Scheduling**: One-time and recurring task scheduling
9//! - **Cron-style Expressions**: Support for cron-like scheduling syntax
10//! - **Action Management**: Execute callbacks and actions at scheduled times
11//! - **Calendar Integration**: Schedule events relative to business days and holidays
12//! - **Time Zone Support**: Multi-timezone scheduling with automatic conversions
13//!
14//! # Examples
15//!
16//! ```ignore
17//! use oxedyne_fe2o3_datime::schedule::{Scheduler, Task, RecurrencePattern};
18//! use oxedyne_fe2o3_datime::time::CalClockZone;
19//!
20//! let mut scheduler = Scheduler::new();
21//! let zone = CalClockZone::utc();
22//!
23//! // Schedule a one-time task
24//! let task = Task::new("backup", zone.clone())
25//! .at_time(14, 30, 0) // 2:30 PM
26//! .on_date(2024, 6, 15)
27//! .with_action(|| println!("Running backup"));
28//!
29//! scheduler.schedule(task)?;
30//!
31//! // Schedule a recurring daily task
32//! let daily_task = Task::new("daily_report", zone)
33//! .at_time(9, 0, 0) // 9:00 AM
34//! .recurrence(RecurrencePattern::Daily)
35//! .with_action(|| println!("Generating daily report"));
36//!
37//! scheduler.schedule(daily_task)?;
38//!
39//! // Process pending tasks
40//! scheduler.process_pending()?;
41//! ```
42//!
43//! [Written with AI entirely](https://need2know.ai/entirely-ai/code)\
44//! Anthropic Claude
45
46pub mod scheduler;
47pub mod task;
48pub mod recurrence;
49pub mod action;
50pub mod executor;
51
52pub use self::{
53 scheduler::{Scheduler, SchedulerConfig, SchedulerStats},
54 task::{Task, TaskId, TaskStatus, TaskPriority, TaskBuilder, TaskExecution, TaskConfig},
55 recurrence::{RecurrencePattern, CronExpression, RecurrenceRule},
56 action::{Action, ActionResult, ActionContext, ActionError},
57 executor::{TaskExecutor, ExecutionResult, ExecutionStats},
58};