[go: up one dir, main page]

Module parser

Module parser 

Source
Expand description

Parser for Cron patterns.

Croner uses CronParser to parse the cron expression. Invoking

Cron::from_str("pattern");

is equivalent to

CronParser::new().parse("pattern");

You can customise the parser by creating a parser builder using CronParser::builder. So, for example, to parse cron patterns with optional seconds do something like this:

use croner::parser::{CronParser, Seconds};

// Configure the parser to allow seconds.
let parser = CronParser::builder().seconds(Seconds::Optional).build();

let cron_with_seconds = parser
    .parse("*/10 * * * * *")
    .unwrap();
let cron_without_seconds = parser
    .parse("* * * * *")
    .unwrap();

Structs§

CronParser
Parser for Cron patterns.
CronParserBuilder
Builder for CronParser.

Enums§

CronParserBuilderError
Error type for CronParserBuilder
Seconds
Year