Skip to main content

for_each_event_store_rule

Macro for_each_event_store_rule 

macro_rules! for_each_event_store_rule {
    ($($callback:tt)+) => { ... };
}
Expand description

Hands the complete event store rule set to $callback.

$callback is the path of a macro that accepts a comma-separated list of identifiers. It is invoked exactly once, with every rule name in rules.

This is the only place the rule set is written down. Anything that needs to iterate the rules — a test harness, a documentation table, the no_orphan_rules meta-test — is built by invoking this macro.

§Examples

A caller-supplied emitter, which is how a runtime this crate has never heard of gets a harness. The callback path is substituted verbatim, so a bare name resolves in your scope:

macro_rules! rule_names {
    ($($name:ident),* $(,)?) => { [ $( stringify!($name) ),* ] };
}

let names = happenstance_testkit::for_each_event_store_rule!(rule_names);
assert!(names.contains(&"append_is_atomic"));
assert!(names.contains(&"racing_conditional_appends_elect_one_winner"));