mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-01-05 02:55:38 +01:00
Merge pull request #52 from tikue/serde_derive
Use the new serde_derive crate.
This commit is contained in:
@@ -20,7 +20,7 @@ lazy_static = "0.2"
|
||||
log = "0.3"
|
||||
scoped-pool = "1.0"
|
||||
serde = "0.8"
|
||||
serde_macros = "0.8"
|
||||
serde_derive = "0.8"
|
||||
snake_to_camel = { path = "src/snake_to_camel" }
|
||||
take = "0.1"
|
||||
tokio-service = { git = "https://github.com/tokio-rs/tokio-service" }
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
// Licensed under the MIT License, <LICENSE or http://opensource.org/licenses/MIT>.
|
||||
// This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
#![feature(conservative_impl_trait, custom_derive, custom_derive, plugin)]
|
||||
#![plugin(serde_macros, snake_to_camel)]
|
||||
#![feature(conservative_impl_trait, plugin, rustc_macro)]
|
||||
#![plugin(snake_to_camel)]
|
||||
|
||||
extern crate futures;
|
||||
#[macro_use]
|
||||
extern crate tarpc;
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
use std::error::Error;
|
||||
use std::fmt;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate tarpc;
|
||||
extern crate serde;
|
||||
extern crate bincode;
|
||||
extern crate env_logger;
|
||||
extern crate futures;
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
//! ```
|
||||
//!
|
||||
#![deny(missing_docs)]
|
||||
#![feature(custom_derive, plugin, question_mark, conservative_impl_trait, never_type)]
|
||||
#![plugin(serde_macros, snake_to_camel)]
|
||||
#![feature(plugin, question_mark, conservative_impl_trait, never_type, rustc_macro)]
|
||||
#![plugin(snake_to_camel)]
|
||||
|
||||
extern crate bincode;
|
||||
extern crate byteorder;
|
||||
@@ -69,6 +69,8 @@ extern crate bytes;
|
||||
extern crate lazy_static;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate take;
|
||||
|
||||
#[doc(hidden)]
|
||||
|
||||
@@ -5,7 +5,6 @@ authors = ["Tim Kuehn <tikue@google.com>"]
|
||||
|
||||
[dependencies]
|
||||
itertools = "0.4"
|
||||
aster = "0.26"
|
||||
|
||||
[lib]
|
||||
plugin = true
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
#![feature(plugin_registrar, rustc_private)]
|
||||
|
||||
extern crate aster;
|
||||
extern crate itertools;
|
||||
extern crate rustc;
|
||||
extern crate rustc_plugin;
|
||||
extern crate syntax;
|
||||
|
||||
use aster::ident::ToIdent;
|
||||
use itertools::Itertools;
|
||||
use syntax::ast::{self, Ident, TraitRef, Ty, TyKind};
|
||||
use syntax::parse::{self, token, PResult};
|
||||
use syntax::parse::{self, PResult, token};
|
||||
use syntax::ptr::P;
|
||||
use syntax::parse::parser::{Parser, PathStyle};
|
||||
use syntax::tokenstream::TokenTree;
|
||||
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
|
||||
use syntax::ext::base::{DummyResult, ExtCtxt, MacEager, MacResult};
|
||||
use syntax::ext::quote::rt::Span;
|
||||
use syntax::util::small_vector::SmallVector;
|
||||
use rustc_plugin::Registry;
|
||||
@@ -88,7 +86,11 @@ fn ty_snake_to_camel(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<MacRe
|
||||
} else {
|
||||
unreachable!()
|
||||
}
|
||||
MacEager::ty(P(Ty {id: ast::DUMMY_NODE_ID, node: ty, span: sp}))
|
||||
MacEager::ty(P(Ty {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
node: ty,
|
||||
span: sp,
|
||||
}))
|
||||
}
|
||||
|
||||
fn convert(ident: &mut Ident) {
|
||||
@@ -122,7 +124,7 @@ fn convert(ident: &mut Ident) {
|
||||
}
|
||||
}
|
||||
|
||||
*ident = camel_ty.to_ident();
|
||||
*ident = Ident::with_empty_ctxt(token::intern(&camel_ty));
|
||||
}
|
||||
|
||||
trait ParseTraitRef {
|
||||
@@ -146,4 +148,3 @@ pub fn plugin_registrar(reg: &mut Registry) {
|
||||
reg.register_macro("impl_snake_to_camel", impl_snake_to_camel);
|
||||
reg.register_macro("ty_snake_to_camel", ty_snake_to_camel);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user