juniper/juniper_codegen/src/lib.rs
Dirkjan Ochtman 62d015cf86 Upgrade juniper_codegen dependencies (#231)
* Upgrade `juniper_codegen` to `syn-0.14`/`quote-0.6`

* Upgrade `juniper_codegen` to `regex-1.0`

* Fix comment typos in enum derive code

* Stop testing rust-1.21.0, replace with rust-1.23.0. rust-1.21.0 breaks with the newer dependencies
2018-08-27 14:51:12 -07:00

44 lines
1.2 KiB
Rust

//! This crate supplies custom derive implementations for the
//! [juniper](https://github.com/graphql-rust/juniper) crate.
//!
//! You should not depend on juniper_codegen directly.
//! You only need the `juniper` crate.
#![recursion_limit = "1024"]
extern crate proc_macro;
extern crate proc_macro2;
#[macro_use]
extern crate quote;
extern crate syn;
#[macro_use]
extern crate lazy_static;
extern crate regex;
mod derive_enum;
mod derive_input_object;
mod derive_object;
mod util;
use proc_macro::TokenStream;
#[proc_macro_derive(GraphQLEnum, attributes(graphql))]
pub fn derive_enum(input: TokenStream) -> TokenStream {
let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
let gen = derive_enum::impl_enum(&ast);
gen.into()
}
#[proc_macro_derive(GraphQLInputObject, attributes(graphql))]
pub fn derive_input_object(input: TokenStream) -> TokenStream {
let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
let gen = derive_input_object::impl_input_object(&ast);
gen.into()
}
#[proc_macro_derive(GraphQLObject, attributes(graphql))]
pub fn derive_object(input: TokenStream) -> TokenStream {
let ast = syn::parse::<syn::DeriveInput>(input).unwrap();
let gen = derive_object::impl_object(&ast);
gen.into()
}