Skip to main content

larust_scheduler/
lib.rs

1//! Recurring, in-process task scheduling - Laravel's `$schedule->command(...)
2//! ->daily()`, driven by `xr schedule:work` the same way `xr queue:work`
3//! drives `larust-queue`.
4//!
5//! A scheduled task is a plain closure, not a trait implemented once per
6//! task the way `larust_queue::Job` is. `Job` needs `Serialize +
7//! DeserializeOwned` because it survives a process boundary - dispatched
8//! now, run later, possibly by a different `xr queue:work` process, via a
9//! SQLite row. A scheduled task runs in the exact same process, same
10//! memory, that declared it; there's no boundary to cross, so no
11//! serialization need, so no trait. The right precedent is
12//! `larust_events::ListenerRegistry::on<E, F, Fut>` (a payload-carrying
13//! closure registry), not `Job` - `Schedule::cron`'s `BoxedTask` is the
14//! same shape minus the payload parameter.
15//!
16//! Re-exported through `larust_support::schedule` (see
17//! `crates/larust-support/src/lib.rs`) so generated apps depend only on
18//! `larust-support`, never on this crate, `cron`, or `chrono` directly -
19//! `Schedule::cron`'s own public signature never mentions either type.
20
21mod schedule;
22
23pub use schedule::{work, Schedule};