summaryrefslogtreecommitdiff
path: root/macros/src/util.rs
blob: 43779c13f52e21562a35a349235267efafa296b9 (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
30
31
32
33
use syn::punctuated::Punctuated;
use syn::token::Paren;
use syn::TypeTuple;

pub fn create_unit_type_tuple() -> TypeTuple
{
    TypeTuple {
        paren_token: Paren::default(),
        elems: Punctuated::new(),
    }
}

macro_rules! create_path {
    ($($segment: ident)::+) => {
        Path::new(
            WithLeadingColons::No,
            [$(
                PathSegment::new(format_ident!(stringify!($segment)), None)
            ),+],
        )
    };

    (::$($segment: ident)::+) => {
        ::syn::Path::new(
            WithLeadingColons::Yes,
            [$(
                ::syn::PathSegment::new(format_ident!(stringify!($segment)), None)
            ),+],
        )
    };
}

pub(crate) use create_path;