rglw_api_codegen 0.0.1

Rustyglware websocket api.
Documentation
use proc_macro::TokenStream;
use rglw::codegen_utils::macro_attribute_arguments::MacroAttributeArguments;
use syn::{DeriveInput, ItemFn, parse_macro_input};

mod derives;
mod attributes;
mod procedural;

#[proc_macro_derive(BinaryMessage)]
pub fn binary_message(input: TokenStream) -> TokenStream {
    derives::binary_message::implementation(input)
}

#[proc_macro_derive(Injectable)]
pub fn injectable(input: TokenStream) -> TokenStream {
    derives::injectable::implementation(parse_macro_input!(input as DeriveInput)).into()
}

#[proc_macro_derive(Service, attributes(service_type))]
pub fn service(input: TokenStream) -> TokenStream {
    derives::service::implementation(parse_macro_input!(input as DeriveInput)).into()
}

#[proc_macro_attribute]
pub fn controller(attr: TokenStream, input: TokenStream) -> TokenStream {
    attributes::controller::implementation(parse_macro_input!(attr as MacroAttributeArguments), parse_macro_input!(input as ItemFn)).into()
}

#[proc_macro_attribute]
pub fn handler(attr: TokenStream, input: TokenStream) -> TokenStream {
    attributes::handler::implementation(parse_macro_input!(attr as MacroAttributeArguments), parse_macro_input!(input as ItemFn)).into()
}

#[proc_macro]
pub fn setup_routes(input: TokenStream) -> TokenStream {
    procedural::setup_routes::implementation(input.into()).into()
}