2018-08-07 02:58:07 +00:00
|
|
|
#![feature(proc_macro_diagnostic)]
|
|
|
|
#![feature(crate_visibility_modifier)]
|
|
|
|
#![recursion_limit="128"]
|
2018-04-12 23:07:37 +00:00
|
|
|
|
|
|
|
#[macro_use] extern crate quote;
|
2018-08-07 02:58:07 +00:00
|
|
|
#[macro_use] extern crate derive_utils;
|
|
|
|
extern crate proc_macro;
|
|
|
|
extern crate rocket_http;
|
2018-04-12 23:07:37 +00:00
|
|
|
|
2018-08-07 02:58:07 +00:00
|
|
|
mod derive;
|
|
|
|
mod http_codegen;
|
2018-04-12 23:07:37 +00:00
|
|
|
|
2018-08-07 02:58:07 +00:00
|
|
|
crate use derive_utils::{syn, proc_macro2};
|
2018-04-12 23:07:37 +00:00
|
|
|
|
2018-08-07 02:58:07 +00:00
|
|
|
use proc_macro::TokenStream;
|
2018-04-12 23:07:37 +00:00
|
|
|
|
2018-08-07 02:58:07 +00:00
|
|
|
#[proc_macro_derive(FromFormValue, attributes(form))]
|
|
|
|
pub fn derive_from_form_value(input: TokenStream) -> TokenStream {
|
|
|
|
derive::from_form_value::derive_from_form_value(input)
|
2018-04-12 23:07:37 +00:00
|
|
|
}
|
|
|
|
|
2018-08-07 02:58:07 +00:00
|
|
|
#[proc_macro_derive(FromForm, attributes(form))]
|
|
|
|
pub fn derive_from_form(input: TokenStream) -> TokenStream {
|
|
|
|
derive::from_form::derive_from_form(input)
|
2018-04-12 23:07:37 +00:00
|
|
|
}
|
|
|
|
|
2018-08-07 02:58:07 +00:00
|
|
|
#[proc_macro_derive(Responder, attributes(response))]
|
|
|
|
pub fn derive_responder(input: TokenStream) -> TokenStream {
|
|
|
|
derive::responder::derive_responder(input)
|
2018-04-12 23:07:37 +00:00
|
|
|
}
|