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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#![recursion_limit = "256"]
#![warn(
missing_debug_implementations,
rust_2018_idioms,
rust_2018_compatibility,
clippy::all
)]
extern crate proc_macro;
use proc_macro::TokenStream;
use syn::{parse_macro_input, DeriveInput};
mod event_reader;
mod prefab_data;
mod system_desc;
mod widget_id;
#[proc_macro_derive(EventReader, attributes(reader))]
pub fn event_reader_derive(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput);
let gen = event_reader::impl_event_reader(&ast);
gen.into()
}
#[proc_macro_derive(PrefabData, attributes(prefab))]
pub fn prefab_data_derive(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput);
let gen = prefab_data::impl_prefab_data(&ast);
gen.into()
}
#[proc_macro_derive(WidgetId, attributes(widget_id))]
pub fn widget_id_derive(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput);
let gen = widget_id::impl_widget_id(&ast);
gen.into()
}
#[proc_macro_derive(SystemDesc, attributes(system_desc))]
pub fn system_desc_derive(input: TokenStream) -> TokenStream {
let ast = parse_macro_input!(input as DeriveInput);
let gen = system_desc::impl_system_desc(&ast);
gen.into()
}