mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-06-22 21:51:02 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f6a66a5537 | |||
| fd5ab8c5c8 | |||
| 39fa78e2ec | |||
| e18416ac7f | |||
| b63cc13f3a | |||
| 74b230c183 |
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "0.6.12"
|
version = "0.6.14"
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "A generic serialization/deserialization framework"
|
description = "A generic serialization/deserialization framework"
|
||||||
@@ -17,5 +17,5 @@ num-impls = ["num-bigint", "num-complex", "num-rational"]
|
|||||||
num-rational = ["num/rational"]
|
num-rational = ["num/rational"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clippy = { version = "^0.0.39", optional = true }
|
clippy = { version = "^0.*", optional = true }
|
||||||
num = { version = "^0.1.27", default-features = false }
|
num = { version = "^0.1.27", default-features = false }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_codegen"
|
name = "serde_codegen"
|
||||||
version = "0.6.12"
|
version = "0.6.14"
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "Macros to auto-generate implementations for the serde framework"
|
description = "Macros to auto-generate implementations for the serde framework"
|
||||||
@@ -16,13 +16,13 @@ nightly-testing = ["clippy"]
|
|||||||
with-syntex = ["quasi/with-syntex", "quasi_codegen", "quasi_codegen/with-syntex", "syntex", "syntex_syntax"]
|
with-syntex = ["quasi/with-syntex", "quasi_codegen", "quasi_codegen/with-syntex", "syntex", "syntex_syntax"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
quasi_codegen = { version = "^0.5.0", optional = true }
|
quasi_codegen = { version = "^0.7.0", optional = true }
|
||||||
syntex = { version = "^0.27.0", optional = true }
|
syntex = { version = "^0.29.0", optional = true }
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
aster = { version = "^0.11.0", default-features = false }
|
aster = { version = "^0.13.1", default-features = false }
|
||||||
clippy = { version = "^0.0.39", optional = true }
|
clippy = { version = "^0.*", optional = true }
|
||||||
quasi = { version = "^0.5.0", default-features = false }
|
quasi = { version = "^0.7.0", default-features = false }
|
||||||
quasi_macros = { version = "^0.5.0", optional = true }
|
quasi_macros = { version = "^0.7.0", optional = true }
|
||||||
syntex = { version = "^0.27.0", optional = true }
|
syntex = { version = "^0.29.0", optional = true }
|
||||||
syntex_syntax = { version = "^0.27.0", optional = true }
|
syntex_syntax = { version = "^0.29.0", optional = true }
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ fn deserialize_seq(
|
|||||||
struct_path: ast::Path,
|
struct_path: ast::Path,
|
||||||
fields: usize,
|
fields: usize,
|
||||||
) -> P<ast::Expr> {
|
) -> P<ast::Expr> {
|
||||||
let let_values: Vec<P<ast::Stmt>> = (0 .. fields)
|
let let_values: Vec<ast::Stmt> = (0 .. fields)
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
let name = builder.id(format!("__field{}", i));
|
let name = builder.id(format!("__field{}", i));
|
||||||
quote_stmt!(cx,
|
quote_stmt!(cx,
|
||||||
@@ -427,7 +427,7 @@ fn deserialize_struct_as_seq(
|
|||||||
struct_path: ast::Path,
|
struct_path: ast::Path,
|
||||||
fields: &[ast::StructField],
|
fields: &[ast::StructField],
|
||||||
) -> Result<P<ast::Expr>, ()> {
|
) -> Result<P<ast::Expr>, ()> {
|
||||||
let let_values: Vec<P<ast::Stmt>> = (0 .. fields.len())
|
let let_values: Vec<ast::Stmt> = (0 .. fields.len())
|
||||||
.map(|i| {
|
.map(|i| {
|
||||||
let name = builder.id(format!("__field{}", i));
|
let name = builder.id(format!("__field{}", i));
|
||||||
quote_stmt!(cx,
|
quote_stmt!(cx,
|
||||||
@@ -574,8 +574,8 @@ fn deserialize_item_enum(
|
|||||||
// Match arms to extract a variant from a string
|
// Match arms to extract a variant from a string
|
||||||
let mut variant_arms = vec![];
|
let mut variant_arms = vec![];
|
||||||
for (i, variant) in enum_def.variants.iter().enumerate() {
|
for (i, variant) in enum_def.variants.iter().enumerate() {
|
||||||
let variant_name = builder.pat().enum_()
|
let variant_name = builder.pat().path()
|
||||||
.id("__Field").id(format!("__field{}", i)).build()
|
.id("__Field").id(format!("__field{}", i))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let expr = try!(deserialize_variant(
|
let expr = try!(deserialize_variant(
|
||||||
@@ -930,7 +930,7 @@ fn deserialize_struct_visitor(
|
|||||||
builder: &aster::AstBuilder,
|
builder: &aster::AstBuilder,
|
||||||
struct_path: ast::Path,
|
struct_path: ast::Path,
|
||||||
fields: &[ast::StructField],
|
fields: &[ast::StructField],
|
||||||
) -> Result<(Vec<P<ast::Item>>, P<ast::Stmt>, P<ast::Expr>), ()> {
|
) -> Result<(Vec<P<ast::Item>>, ast::Stmt, P<ast::Expr>), ()> {
|
||||||
let field_visitor = deserialize_field_visitor(
|
let field_visitor = deserialize_field_visitor(
|
||||||
cx,
|
cx,
|
||||||
builder,
|
builder,
|
||||||
@@ -977,7 +977,7 @@ fn deserialize_map(
|
|||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Declare each field.
|
// Declare each field.
|
||||||
let let_values: Vec<P<ast::Stmt>> = field_names.iter()
|
let let_values: Vec<ast::Stmt> = field_names.iter()
|
||||||
.map(|field_name| quote_stmt!(cx, let mut $field_name = None;).unwrap())
|
.map(|field_name| quote_stmt!(cx, let mut $field_name = None;).unwrap())
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@@ -994,7 +994,7 @@ fn deserialize_map(
|
|||||||
|
|
||||||
let field_attrs = try!(field::struct_field_attrs(cx, builder, fields));
|
let field_attrs = try!(field::struct_field_attrs(cx, builder, fields));
|
||||||
|
|
||||||
let extract_values: Vec<P<ast::Stmt>> = field_names.iter()
|
let extract_values: Vec<ast::Stmt> = field_names.iter()
|
||||||
.zip(field_attrs.iter())
|
.zip(field_attrs.iter())
|
||||||
.map(|(field_name, field_attr)| {
|
.map(|(field_name, field_attr)| {
|
||||||
let missing_expr = if field_attr.use_default() {
|
let missing_expr = if field_attr.use_default() {
|
||||||
|
|||||||
@@ -313,8 +313,8 @@ fn serialize_variant(
|
|||||||
|
|
||||||
match variant.node.data {
|
match variant.node.data {
|
||||||
ast::VariantData::Unit(_) => {
|
ast::VariantData::Unit(_) => {
|
||||||
let pat = builder.pat().enum_()
|
let pat = builder.pat().path()
|
||||||
.id(type_ident).id(variant_ident).build()
|
.id(type_ident).id(variant_ident)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
Ok(quote_arm!(cx,
|
Ok(quote_arm!(cx,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "serde_macros"
|
name = "serde_macros"
|
||||||
version = "0.6.12"
|
version = "0.6.14"
|
||||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
|
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>"]
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "Macros to auto-generate implementations for the serde framework"
|
description = "Macros to auto-generate implementations for the serde framework"
|
||||||
@@ -16,14 +16,14 @@ plugin = true
|
|||||||
nightly-testing = ["clippy", "serde/nightly-testing", "serde_codegen/nightly-testing"]
|
nightly-testing = ["clippy", "serde/nightly-testing", "serde_codegen/nightly-testing"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clippy = { version = "^0.0.39", optional = true }
|
clippy = { version = "^0.*", optional = true }
|
||||||
serde_codegen = { version = "^0.6.12", path = "../serde_codegen", default-features = false, features = ["nightly"] }
|
serde_codegen = { version = "^0.6.14", path = "../serde_codegen", default-features = false, features = ["nightly"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
compiletest_rs = "^0.0.11"
|
compiletest_rs = "^0.0.11"
|
||||||
num = "^0.1.27"
|
num = "^0.1.27"
|
||||||
rustc-serialize = "^0.3.16"
|
rustc-serialize = "^0.3.16"
|
||||||
serde = { version = "^0.6.12", path = "../serde", features = ["num-impls"] }
|
serde = { version = "^0.6.14", path = "../serde", features = ["num-impls"] }
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "test"
|
name = "test"
|
||||||
|
|||||||
@@ -14,18 +14,18 @@ build = "build.rs"
|
|||||||
nightly-testing = ["clippy", "serde/nightly-testing", "serde_codegen/nightly-testing"]
|
nightly-testing = ["clippy", "serde/nightly-testing", "serde_codegen/nightly-testing"]
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
syntex = { version = "^0.27.0" }
|
syntex = { version = "^0.29.0" }
|
||||||
syntex_syntax = { version = "^0.27.0" }
|
syntex_syntax = { version = "^0.29.0" }
|
||||||
serde_codegen = { version = "^0.6.12", path = "../serde_codegen", features = ["with-syntex"] }
|
serde_codegen = { version = "^0.6.14", path = "../serde_codegen", features = ["with-syntex"] }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
num = "^0.1.26"
|
num = "^0.1.26"
|
||||||
rustc-serialize = "^0.3.16"
|
rustc-serialize = "^0.3.16"
|
||||||
serde = { version = "*", path = "../serde", features = ["num-impls"] }
|
serde = { version = "*", path = "../serde", features = ["num-impls"] }
|
||||||
syntex = "^0.27.0"
|
syntex = "^0.29.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clippy = { version = "^0.0.39", optional = true }
|
clippy = { version = "^0.*", optional = true }
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "test"
|
name = "test"
|
||||||
|
|||||||
Reference in New Issue
Block a user