Generating Tasks
The fastest way to create a new scheduled task is using the Kit CLI:- Create
src/tasks/cleanup_logs_task.rswith a task stub - Create
src/tasks/mod.rsif it doesn’t exist - Create
src/schedule.rsfor registering tasks - Create
src/bin/schedule.rsscheduler binary
Defining Schedules
Kit supports two approaches for defining scheduled tasks:1. Trait-Based Tasks (Recommended)
For complex tasks that need dependencies or reusable logic, implement theTask trait and configure the schedule during registration:
src/schedule.rs:
2. Closure-Based Tasks
For quick, inline tasks without separate files:Registering Tasks
Register your tasks insrc/schedule.rs:
Schedule Frequency Options
Kit provides a fluent API for defining when tasks should run:Common Intervals
Day-Specific Schedules
Time Modifiers
Chain.at() with any schedule to set a specific time: