16 releases (8 breaking)
Uses new Rust 2024
new 0.10.2 | May 5, 2025 |
---|---|
0.9.0 | May 5, 2025 |
#629 in Asynchronous
1,193 downloads per month
18KB
353 lines
Easy Schedule
A flexible task scheduler built on Tokio with multiple scheduling options and skip conditions.
Features
- Multiple scheduling types:
- Delayed execution
- Interval execution
- Scheduled execution
- One-time execution
- Flexible skip conditions:
- Skip specific dates
- Skip date ranges
- Skip weekdays
- Skip specific times
- Skip time ranges
- Task cancellation support
- Comprehensive logging
Quick Start
Add to your Cargo.toml
:
[dependencies]
easy-schedule = "0.1"
Usage Example
use async_trait::async_trait;
use easy_schedule::{CancellationToken, Notifiable, Scheduler, Task};
#[derive(Debug, Clone)]
struct WaitTask;
#[async_trait]
impl Notifiable for WaitTask {
fn get_schedule(&self) -> Task {
Task::Wait(3, None)
}
async fn on_time(&self, cancel: CancellationToken) {
// ...
}
async fn on_skip(&self, _cancel: CancellationToken) {
// ...
}
}
#[tokio::main]
async fn main() {
let scheduler = Scheduler::new();
scheduler.run(WaitTask).await;
}
License
Dual-licensed under MIT or Apache-2.0.
Dependencies
~4–10MB
~92K SLoC