moonbitstack/moondate/cron does not have a README file

    Refused

    pub(all) suberror Refused {
    Fields(got~ : Int)
    Range(field~ : String, got~ : Int, low~ : Int, high~ : Int)
    Malformed(String)
    } derive(Eq,
    Debug
    )

    Why an expression was refused.
    impl Show for Refused

    Refused::equal

    fn Refused::equal(Refused, Refused) -> Bool

    Refused::not_equal

    fn Refused::not_equal(x : Refused, y : Refused) -> Bool

    Refused::output

    fn Refused::output(self : Refused, logger : &Logger) -> Unit

    Refused::to_repr

    Refused::to_string

    fn Refused::to_string(self : Refused) -> String

    Cron

    pub(all) struct Cron {
    seconds : Int64
    minutes : Int64
    hours : Int
    days : Int
    months : Int
    weekdays : Int
    star_day : Bool
    star_week : Bool
    } derive(Eq,
    Debug
    )

    A parsed expression: which values of each field it fires on.

    Each field is a bit set, so asking whether a moment matches is six bit tests rather than a search. star_day and star_week are kept because the two fields interact — see [Cron::matches].

    Cron::equal

    fn Cron::equal(Cron, Cron) -> Bool

    Cron::matches

    fn Cron::matches(self : Cron, m :
    Moment
    ) -> Bool

    Whether m is a moment this expression fires on.

    The day-of-month and day-of-week fields are or-ed when both are restricted, which is Vixie cron's rule and surprises everyone once: 0 0 13 * 5 is the thirteenth or any Friday, not Friday the thirteenth. When one of them is * they are and-ed, which is why 0 0 13 * * is only the thirteenth.

    Cron::next

    The first moment strictly after m that this expression fires on.

    None when it never does. An expression can name a day that does not exist — 0 0 30 2 * is the thirtieth of February — so the search is bounded at four years, which is past any leap-year cycle a real schedule turns on.

    Cron::not_equal

    fn Cron::not_equal(x : Cron, y : Cron) -> Bool

    Cron::to_repr

    parse

    fn parse(expr : StringView) -> Cron raise Refused

    An expression, in the five-field form crontab(5) defines or the six-field form that puts seconds in front.

    ┌───────────── second (0-59, six-field form only) │ ┌───────────── minute (0-59) │ │ ┌───────────── hour (0-23) │ │ │ ┌───────────── day of month (1-31) │ │ │ │ ┌───────────── month (1-12 or JAN-DEC) │ │ │ │ │ ┌───────────── day of week (0-7 or SUN-SAT, both 0 and 7 being Sunday) * * * * * *

    Each field takes *, a number, a range a-b, a step */n or a-b/n, and a comma-separated list of those. ? reads as *, which is how a scheduler spells the day field it is not using.

    The shorthands @yearly, @annually, @monthly, @weekly, @daily, @midnight and @hourly are the ones crontab(5) lists. @reboot is not here: it names an event rather than a time, and this package answers when something fires, not why.

    Source Files