Easy Schedule
A flexible and powerful task scheduler built on Tokio, providing multiple scheduling options with advanced skip conditions and timezone support.
โจ Features
๐ Multiple Scheduling Types
- Wait - Execute once after a delay
- Interval - Execute repeatedly at fixed intervals
- At - Execute daily at specific times
- Once - Execute at an exact datetime
๐ซ Flexible Skip Conditions
- Date-based: Skip specific dates or date ranges
- Weekday-based: Skip specific weekdays or weekday ranges
- Time-based: Skip specific times or time ranges (including overnight ranges)
- Combinable: Use multiple skip rules together
๐ Advanced Features
- Timezone Support - Full timezone support with minute-level precision
- String Parsing - Create tasks from intuitive strings like
wait(5),at(14:30) - Cancellation - Comprehensive task cancellation support
- Error Handling - Robust error handling with sensible defaults
- Async/Await - Full async support with Tokio integration
๐ Quick Start
Add to your Cargo.toml:
[]
= "0.10"
= { = "1", = ["full"] }
= { = "0.3", = ["macros"] }
๐ Usage Examples
Basic Task Types
use *;
use ;
async
Skip Conditions
use *;
use ;
;
String Parsing
use *;
// โ
Safe parsing with error handling
match parse
// โ ๏ธ Direct parsing (panics on error)
let task = from; // Wait 30 seconds
// Multiple tasks with error handling
let task_strings = vec!;
let tasks: = task_strings
.iter
.map
.collect;
match tasks
Timezone Support
use *;
// Different timezone configurations
let utc_scheduler = with_timezone; // UTC
let tokyo_scheduler = with_timezone; // JST
let india_scheduler = with_timezone; // IST
let ny_scheduler = with_timezone; // EST
// Or use minute offsets directly
let custom_scheduler = with_timezone_minutes; // UTC+5:30
๐ Task Types Reference
| Type | Description | Example |
|---|---|---|
Wait(seconds, skip) |
Execute once after delay | Task::Wait(30, None) |
Interval(seconds, skip) |
Execute repeatedly | Task::Interval(60, None) |
At(time, skip) |
Execute daily at time | Task::At(time!(14:30), None) |
Once(datetime, skip) |
Execute at exact datetime | Task::Once(datetime, None) |
๐ซ Skip Rules Reference
| Skip Type | Description | Example |
|---|---|---|
Date(date) |
Skip specific date | Skip::Date(date!(2024-12-25)) |
DateRange(start, end) |
Skip date range | Skip::DateRange(start, end) |
Day(weekdays) |
Skip weekdays (1=Mon, 7=Sun) | Skip::Day(vec![6, 7]) |
DayRange(start, end) |
Skip weekday range | Skip::DayRange(1, 5) |
Time(time) |
Skip specific time | Skip::Time(time!(12:00)) |
TimeRange(start, end) |
Skip time range | Skip::TimeRange(time!(22:00), time!(06:00)) |
๐ ๏ธ Advanced Usage
Custom Cancellation Logic
Multiple Skip Conditions
let complex_skips = vec!;
Interval // Every 30 minutes with conditions
๐๏ธ Architecture
The library follows a clean separation of concerns:
Task- Defines when to execute (Wait, Interval, At, Once)Skip- Defines when NOT to execute (dates, times, weekdays)Notifiable- Your business logic (what to execute)Scheduler- Orchestrates everything with timezone support
๐งช Testing
Run the comprehensive test suite:
๐ Examples
Check out the examples/ directory for complete working examples:
basic.rs- Basic scheduling with all task typesskip_example.rs- Advanced skip conditionsstring_parsing.rs- String-based task creationerror_handling.rs- Robust error handling patterns
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.