Skip to main content

ScheduleDriver

Trait ScheduleDriver 

Source
pub trait ScheduleDriver: Send + Sync {
    // Required methods
    fn schedule(&self, entry: ScheduleEntry) -> ScheduleHandle;
    fn cancel(&self, handle: &ScheduleHandle);
    fn dispose(&self);
}
Expand description

Driver-owned scheduling abstraction. Mirrors the TS ScheduleDriver interface (cron/schedule-driver.ts) exactly: the driver parses the schedule, arms the timer, reschedules cron entries after each fire, and tears everything down on ScheduleDriver::dispose. This is the documented extension point: a custom driver (deterministic virtual-time test driver, fire-immediately driver, etc.) fully controls timing.

Required Methods§

Source

fn schedule(&self, entry: ScheduleEntry) -> ScheduleHandle

Schedule a callback to fire on a cron expression or at a specific time. Returns a cancellation handle.

Source

fn cancel(&self, handle: &ScheduleHandle)

Cancel a previously scheduled entry.

Source

fn dispose(&self)

Tear down all scheduled work.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§