use syn::{parse_macro_input, DeriveInput, Error}; mod bindgen; mod component; #[proc_macro_derive(Lift, attributes(component))] 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() } #[proc_macro_derive(Lower, attributes(component))] 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() } #[proc_macro_derive(ComponentType, attributes(component))] 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() } #[proc_macro] pub fn flags(input: proc_macro::TokenStream) -> proc_macro::TokenStream { component::expand_flags(&parse_macro_input!(input as component::Flags)) .unwrap_or_else(Error::into_compile_error) .into() } #[proc_macro] pub fn bindgen(input: proc_macro::TokenStream) -> proc_macro::TokenStream { bindgen::expand(&parse_macro_input!(input as bindgen::Config)) .unwrap_or_else(Error::into_compile_error) .into() }