Pull codegen into it's own crate
This commit is contained in:
parent
426394cd7b
commit
24ac61f9f2
12
serde_codegen/Cargo.toml
Normal file
12
serde_codegen/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "serde_codegen"
|
||||
version = "0.4.0"
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "Macros to auto-generate implementations for the serde framework"
|
||||
repository = "https://github.com/erickt/rust-serde"
|
||||
|
||||
[dependencies]
|
||||
aster = "*"
|
||||
quasi = "*"
|
||||
quasi_macros = "*"
|
@ -7,7 +7,7 @@ use syntax::ptr::P;
|
||||
|
||||
use aster;
|
||||
|
||||
use attr::FieldAttrs;
|
||||
use super::attr::FieldAttrs;
|
||||
|
||||
enum Rename<'a> {
|
||||
None,
|
24
serde_codegen/src/lib.rs
Normal file
24
serde_codegen/src/lib.rs
Normal file
@ -0,0 +1,24 @@
|
||||
#![feature(custom_derive, plugin, rustc_private, unboxed_closures)]
|
||||
#![plugin(quasi_macros)]
|
||||
|
||||
extern crate aster;
|
||||
extern crate quasi;
|
||||
extern crate rustc;
|
||||
extern crate syntax;
|
||||
|
||||
mod attr;
|
||||
mod de;
|
||||
mod field;
|
||||
mod ser;
|
||||
|
||||
pub fn register(reg: &mut rustc::plugin::Registry) {
|
||||
reg.register_syntax_extension(
|
||||
syntax::parse::token::intern("derive_Serialize"),
|
||||
syntax::ext::base::Decorator(
|
||||
Box::new(ser::expand_derive_serialize)));
|
||||
|
||||
reg.register_syntax_extension(
|
||||
syntax::parse::token::intern("derive_Deserialize"),
|
||||
syntax::ext::base::Decorator(
|
||||
Box::new(de::expand_derive_deserialize)));
|
||||
}
|
@ -11,6 +11,4 @@ name = "serde_macros"
|
||||
plugin = true
|
||||
|
||||
[dependencies]
|
||||
aster = "*"
|
||||
quasi = "*"
|
||||
quasi_macros = "*"
|
||||
serde_codegen = { version = "*", path = "../serde_codegen" }
|
||||
|
@ -1,28 +1,10 @@
|
||||
#![feature(custom_derive, plugin, plugin_registrar, rustc_private, unboxed_closures)]
|
||||
#![plugin(quasi_macros)]
|
||||
#![feature(plugin_registrar, rustc_private)]
|
||||
|
||||
extern crate aster;
|
||||
extern crate quasi;
|
||||
extern crate serde_codegen;
|
||||
extern crate rustc;
|
||||
extern crate syntax;
|
||||
|
||||
use syntax::ext::base::Decorator;
|
||||
use syntax::parse::token;
|
||||
use rustc::plugin::Registry;
|
||||
|
||||
mod attr;
|
||||
mod field;
|
||||
mod de;
|
||||
mod ser;
|
||||
|
||||
#[plugin_registrar]
|
||||
#[doc(hidden)]
|
||||
pub fn plugin_registrar(reg: &mut Registry) {
|
||||
reg.register_syntax_extension(
|
||||
token::intern("derive_Serialize"),
|
||||
Decorator(Box::new(ser::expand_derive_serialize)));
|
||||
|
||||
reg.register_syntax_extension(
|
||||
token::intern("derive_Deserialize"),
|
||||
Decorator(Box::new(de::expand_derive_deserialize)));
|
||||
pub fn plugin_registrar(reg: &mut rustc::plugin::Registry) {
|
||||
serde_codegen::register(reg);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user