Skip to main content

schedule

Macro schedule 

Source
macro_rules! schedule {
    (
        $( $hh1:expr,$mm1:expr $( => $kind:expr $( , $comment:expr )* => $hh2:expr,$mm2:expr )+ );*
        $( ; )?
    ) => { ... };
}
Expand description

Macro that allows to quickly create a complex schedule.

ยงSyntax

You can define multiple sequences of time as follows :

{time_0} => {state_1} => {time_2} => {state_2} => ... => {state_n} => {time_n};

Where the time values are written {hour},{minutes} and states are a RuleKind value, optionally followed by a list of comment literals.

use opening_hours_syntax::{ExtendedTime, RuleKind};

opening_hours::schedule! {
     9,00 => RuleKind::Open => 12,00;
    14,00 => RuleKind::Open => 18,00
          => RuleKind::Unknown, "Closes when stock is depleted" => 20,00;
    22,00 => RuleKind::Closed, "Maintenance team only" => 26,00;
};