-
Notifications
You must be signed in to change notification settings - Fork 7
/
mod.rs
50 lines (42 loc) · 1.4 KB
/
mod.rs
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
use syn::{parse_macro_input, DeriveInput, Error};
mod bindgen;
mod component;
pub use component::{Style, VariantStyle};
use crate::CompilationTarget;
pub fn lift(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
component::expand(
&component::LiftExpander,
&parse_macro_input!(input as DeriveInput),
)
.unwrap_or_else(Error::into_compile_error)
.into()
}
pub fn lower(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
component::expand(
&component::LowerExpander,
&parse_macro_input!(input as DeriveInput),
)
.unwrap_or_else(Error::into_compile_error)
.into()
}
pub fn component_type(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
component::expand(
&component::ComponentTypeExpander,
&parse_macro_input!(input as DeriveInput),
)
.unwrap_or_else(Error::into_compile_error)
.into()
}
pub fn flags(input: proc_macro::TokenStream, target: CompilationTarget) -> proc_macro::TokenStream {
component::expand_flags(&parse_macro_input!(input as component::Flags), target)
.unwrap_or_else(Error::into_compile_error)
.into()
}
pub fn bindgen(
input: proc_macro::TokenStream,
target: CompilationTarget,
) -> proc_macro::TokenStream {
bindgen::expand(&parse_macro_input!(input as bindgen::Config), target)
.unwrap_or_else(Error::into_compile_error)
.into()
}