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
42
43
44
45
46
47
48
49
50
51
52
#![doc(html_playground_url = "https://play.rust-lang.org/")]
extern crate proc_macro;
#[macro_use]
extern crate frunk_core;
#[macro_use]
extern crate quote;
extern crate syn;
use proc_macro::TokenStream;
mod common;
mod derive_generic;
use derive_generic::impl_generic;
mod derive_labelled_generic;
use derive_labelled_generic::impl_labelled_generic;
#[proc_macro_derive(Generic)]
pub fn generic(input: TokenStream) -> TokenStream {
let gen = impl_generic(input);
gen.parse().unwrap()
}
#[proc_macro_derive(LabelledGeneric)]
pub fn labelled_generic(input: TokenStream) -> TokenStream {
let gen = impl_labelled_generic(input);
gen.parse().unwrap()
}