aboutsummaryrefslogtreecommitdiff
path: root/macros/src/util/mod.rs
blob: 7ab218545188d97c7bfadda7a0aabe8c99fb7332 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
pub mod error;
pub mod item_impl;
pub mod iterator_ext;
pub mod string;
pub mod syn_ext;
pub mod syn_path;
pub mod tokens;

macro_rules! to_option {
    ($($tokens: tt)+) => {
        Some($($tokens)+)
    };

    () => {
        None
    };
}

macro_rules! or {
    (($($tokens: tt)+) else ($($default: tt)*)) => {
        $($tokens)*
    };

    (() else ($($default: tt)*)) => {
        $($default)*
    };
}

pub(crate) use {or, to_option};