aboutsummaryrefslogtreecommitdiff
path: root/macros/src/util/mod.rs
blob: 224422955b820afcef2ae5c5543214dd91174ac1 (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
pub mod error;
pub mod item_impl;
pub mod iterator_ext;
pub mod string;
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};