Skip to main content

## template

# Macro template

Source

    macro_rules! template {
        (Word) => { ... };
        (Word, $link: literal) => { ... };
        (List: $descr: expr) => { ... };
        (List: $descr: expr, $link: literal) => { ... };
        (OneOf: $one_of: expr) => { ... };
        (NameValueStr: [$($descr: literal),* $(,)?]) => { ... };
        (NameValueStr: [$($descr: literal),* $(,)?], $link: literal) => { ... };
        (NameValueStr: $descr: literal) => { ... };
        (NameValueStr: $descr: literal, $link: literal) => { ... };
        (Word, List: $descr: expr) => { ... };
        (Word, List: $descr: expr, $link: literal) => { ... };
        (Word, NameValueStr: $descr: expr) => { ... };
        (Word, NameValueStr: $descr: expr, $link: literal) => { ... };
        (List: $descr1: expr, NameValueStr: $descr2: expr) => { ... };
        (List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => { ... };
        (Word, List: $descr1: expr, NameValueStr: $descr2: expr) => { ... };
        (Word, List: $descr1: expr, NameValueStr: $descr2: expr, $link: literal) => { ... };
        (@ $word: expr, $list: expr, $one_of: expr, $name_value_str: expr, $link: expr) => { ... };
    }

Expand description

A convenience macro for constructing attribute templates. E.g., `template!(Word, List: "description")` means that the attribute supports forms `#[attr]` and `#[attr(description)]`.