Module std::time::cron

Cron expression parsing and scheduling.

Parse cron expressions and compute the next firing time relative to a given epoch timestamp.

Examples

import std::time::cron;
import std::time::datetime;

fn main() {
    let expr = cron.parse("0 */5 * * *");
    let next_run = expr.next(datetime.now_secs());
    println(next_run);
    expr.free();
}

Contents

Functions

Function parse

pub fn parse(expr: String) -> Expr

Parse a cron expression string.

Panics if the expression syntax is invalid.

Examples

let every_minute = cron.parse("* * * * *");
let weekdays_9am = cron.parse("0 9 * * 1-5");

Types

Struct Expr

A parsed cron expression.

Created by cron.parse(expr). Must be freed with free() when no longer needed to avoid leaking memory.

Traits

Trait ExprMethods

Methods available on a parsed Expr.

Methods

fn next(self: Expr, after_epoch_secs: i64) -> i64 fn to_string(self: Expr) -> String fn free(self: Expr)