pub struct Schedule { /* private fields */ }Expand description
A parsed cron expression: minute, hour, day-of-month, month, day-of-week.
Implementations§
Source§impl Schedule
impl Schedule
Sourcepub fn parse(expr: &str) -> Result<Self>
pub fn parse(expr: &str) -> Result<Self>
Parse minute hour day-of-month month day-of-week, or one of the
@daily-style aliases.
@reboot is rejected rather than accepted-and-ignored: it means
something in a crontab and nothing here, and a schedule that parses but
never fires is exactly the failure this whole module is shaped to avoid.
pub fn source(&self) -> &str
Sourcepub fn next_after(&self, after: DateTime<Utc>, tz: Tz) -> Option<DateTime<Utc>>
pub fn next_after(&self, after: DateTime<Utc>, tz: Tz) -> Option<DateTime<Utc>>
The first instant strictly after after at which this schedule fires.
None only when the expression matches no date within four years —
February 30th and friends.
Sourcepub fn prev_at_or_before(
&self,
at: DateTime<Utc>,
tz: Tz,
) -> Option<DateTime<Utc>>
pub fn prev_at_or_before( &self, at: DateTime<Utc>, tz: Tz, ) -> Option<DateTime<Utc>>
The most recent instant at or before at at which this schedule fired.
This is what answers “is it due?”: compare it against the last slot that actually ran. A scheduler that missed forty slots owes one run, and this is the function that makes that true without enumerating the forty.