Skip to main content

rule

Macro rule 

Source
macro_rules! rule {
    (|$list:ident| Passthrough($index:expr)) => { ... };
    (|$list:ident| $list2:ident.node($index:expr)) => { ... };
    (|$list:ident| $body:expr) => { ... };
}
Expand description

Macro to create an ergonomic reduction function

Usage:

rule!(|list| Passthrough(0))
rule!(|list| list.node(0))  // shorthand for passthrough
rule!(|list| MyNode::new(...))