utc-cron-expr 11.2.0

Zero-dependency 5-field and 6-field POSIX/Quartz cron expression parser, O(1) bitmask matcher, and fast civil-calendar next-occurrence calculator.
Documentation
use super::*;

pub(crate) const ALIAS_YEARLY: &str = "@yearly";
pub(crate) const ALIAS_ANNUALLY: &str = "@annually";
pub(crate) const ALIAS_MONTHLY: &str = "@monthly";
pub(crate) const ALIAS_WEEKLY: &str = "@weekly";
pub(crate) const ALIAS_DAILY: &str = "@daily";
pub(crate) const ALIAS_MIDNIGHT: &str = "@midnight";
pub(crate) const ALIAS_HOURLY: &str = "@hourly";
pub(crate) const MAX_SEARCH_YEARS: i32 = 100;

/// Full bitmask for allowed hours (`0..=23`).
pub(crate) const ALL_HOURS_MASK: u64 = (1u64 << 24) - 1;

/// Full bitmask for allowed days of month (`1..=31`).
pub(crate) const ALL_DAYS_MASK: u64 = ((1u64 << 31) - 1) << 1;

/// Full bitmask for allowed months (`1..=12`).
pub(crate) const ALL_MONTHS_MASK: u64 = ((1u64 << 12) - 1) << 1;

/// Full bitmask for allowed weekdays (`0..=6`).
pub(crate) const ALL_WEEKDAYS_MASK: u64 = (1u64 << 7) - 1;

/// Precompiled schedule for `@yearly` / `@annually` (`0 0 0 1 1 *`).
pub(crate) const SCHEDULE_YEARLY: CronSchedule = CronSchedule {
    seconds: 1,
    minutes: 1,
    hours: 1,
    days: 1u64 << 1,
    months: 1u64 << 1,
    weekdays: ALL_WEEKDAYS_MASK,
    day_restricted: true,
    weekday_restricted: false,
};

/// Precompiled schedule for `@monthly` (`0 0 0 1 * *`).
pub(crate) const SCHEDULE_MONTHLY: CronSchedule = CronSchedule {
    seconds: 1,
    minutes: 1,
    hours: 1,
    days: 1u64 << 1,
    months: ALL_MONTHS_MASK,
    weekdays: ALL_WEEKDAYS_MASK,
    day_restricted: true,
    weekday_restricted: false,
};

/// Precompiled schedule for `@weekly` (`0 0 0 * * 0`).
pub(crate) const SCHEDULE_WEEKLY: CronSchedule = CronSchedule {
    seconds: 1,
    minutes: 1,
    hours: 1,
    days: ALL_DAYS_MASK,
    months: ALL_MONTHS_MASK,
    weekdays: 1,
    day_restricted: false,
    weekday_restricted: true,
};

/// Precompiled schedule for `@daily` / `@midnight` (`0 0 0 * * *`).
pub(crate) const SCHEDULE_DAILY: CronSchedule = CronSchedule {
    seconds: 1,
    minutes: 1,
    hours: 1,
    days: ALL_DAYS_MASK,
    months: ALL_MONTHS_MASK,
    weekdays: ALL_WEEKDAYS_MASK,
    day_restricted: false,
    weekday_restricted: false,
};

/// Precompiled schedule for `@hourly` (`0 0 * * * *`).
pub(crate) const SCHEDULE_HOURLY: CronSchedule = CronSchedule {
    seconds: 1,
    minutes: 1,
    hours: ALL_HOURS_MASK,
    days: ALL_DAYS_MASK,
    months: ALL_MONTHS_MASK,
    weekdays: ALL_WEEKDAYS_MASK,
    day_restricted: false,
    weekday_restricted: false,
};