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
34
35
36
37
38
39
40
41
//! implements no changes versions of [`ToTokens`]
use quote::ToTokens;

use crate::*;

macro_rules! raw {
    ($($name: ident),* $(,)?) => {
        $(impl quote::ToTokens for $name{
            fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
                self.0.to_tokens(tokens)
            }
        })*
    };
}

macro_rules! no_bounds {
    ($($name: ident),* $(,)?) => {
        $(impl<T> quote::ToTokens for $name<T> where T: ToTokens{
            fn to_tokens(&self, tokens: &mut proc_macro2::TokenStream) {
                self.0.to_tokens(tokens)
            }
        })*
    };
}

raw!(
    IdentString, ParenthesisizedGroup, BracketedGroup, CurlyBracedGroup,
);

no_bounds!(
    Number, NumberList, Splat, ArrayRepeat, TupleList,
    Parenthesisized, Bracketed, CurlyBraced,
    NotParenthesisized, NotBracketed, NotCurlyBraced,
);


impl<T, const N: usize> quote::ToTokens for Repeat<T, N> where T: ToTokens {
    fn to_tokens(&self, tokens: &mut TokenStream) {
        self.0.to_tokens(tokens)
    }
}