mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 23:27:59 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c34e0940f | |||
| eb6bf16a51 | |||
| 797d049db5 | |||
| d61a373f12 | |||
| e0eea551b4 | |||
| c650a92bf7 |
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde"
|
||||
version = "1.0.21" # remember to update html_root_url
|
||||
version = "1.0.23" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "A generic serialization/deserialization framework"
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Serde types in rustdoc of other crates get linked to here.
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.21")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.23")]
|
||||
|
||||
// Support using Serde without the standard library!
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_derive"
|
||||
version = "1.0.21" # remember to update html_root_url
|
||||
version = "1.0.23" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||
|
||||
@@ -418,8 +418,8 @@ fn deserialize_seq(
|
||||
};
|
||||
let assign = quote! {
|
||||
let #var = match #visit {
|
||||
Some(__value) => __value,
|
||||
None => {
|
||||
_serde::export::Some(__value) => __value,
|
||||
_serde::export::None => {
|
||||
return _serde::export::Err(_serde::de::Error::invalid_length(#index_in_seq, &#expecting));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//!
|
||||
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.21")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.23")]
|
||||
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))]
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(used_underscore_binding))]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_test"
|
||||
version = "1.0.21" # remember to update html_root_url
|
||||
version = "1.0.23" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "Token De/Serializer for testing De/Serialize implementations"
|
||||
|
||||
@@ -352,8 +352,8 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
|
||||
V: Visitor<'de>,
|
||||
{
|
||||
match self.peek_token() {
|
||||
Token::Struct { .. } => {
|
||||
assert_next_token!(self, Token::Struct { name: name, len: fields.len() });
|
||||
Token::Struct { len: n, .. } => {
|
||||
assert_next_token!(self, Token::Struct { name: name, len: n });
|
||||
self.visit_map(Some(fields.len()), Token::StructEnd, visitor)
|
||||
}
|
||||
Token::Map { .. } => {
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
//! # }
|
||||
//! ```
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.21")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.23")]
|
||||
|
||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||
// Whitelisted clippy lints
|
||||
|
||||
@@ -425,10 +425,6 @@ pub enum Token {
|
||||
|
||||
/// The header of a struct.
|
||||
///
|
||||
/// When testing deserialization, the `len` field must match the number of
|
||||
/// fields that the struct expects to deserialize. This may be different
|
||||
/// from the number of fields contained in the input tokens.
|
||||
///
|
||||
/// After this header are the fields of the struct, followed by `StructEnd`.
|
||||
///
|
||||
/// ```rust
|
||||
@@ -465,10 +461,6 @@ pub enum Token {
|
||||
|
||||
/// The header of a struct variant of an enum.
|
||||
///
|
||||
/// When testing deserialization, the `len` field must match the number of
|
||||
/// fields that the struct variant expects to deserialize. This may be
|
||||
/// different from the number of fields contained in the input tokens.
|
||||
///
|
||||
/// After this header are the fields of the struct variant, followed by
|
||||
/// `StructVariantEnd`.
|
||||
///
|
||||
|
||||
@@ -15,4 +15,4 @@ serde_derive = { path = "../serde_derive" }
|
||||
serde_test = { path = "../serde_test" }
|
||||
|
||||
[dependencies]
|
||||
compiletest_rs = { version = "0.2", optional = true }
|
||||
compiletest_rs = { version = "0.3", optional = true }
|
||||
|
||||
@@ -23,6 +23,7 @@ use self::serde::de::{DeserializeOwned, Deserializer};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::marker::PhantomData;
|
||||
use std::option::Option as StdOption;
|
||||
use std::result::Result as StdResult;
|
||||
|
||||
// Try to trip up the generated code if it fails to use fully qualified paths.
|
||||
@@ -32,6 +33,12 @@ struct Result;
|
||||
struct Ok;
|
||||
#[allow(dead_code)]
|
||||
struct Err;
|
||||
#[allow(dead_code)]
|
||||
struct Option;
|
||||
#[allow(dead_code)]
|
||||
struct Some;
|
||||
#[allow(dead_code)]
|
||||
struct None;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -56,7 +63,7 @@ fn test_gen() {
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct WithRef<'a, T: 'a> {
|
||||
#[serde(skip_deserializing)]
|
||||
t: Option<&'a T>,
|
||||
t: StdOption<&'a T>,
|
||||
#[serde(serialize_with="ser_x", deserialize_with="de_x")]
|
||||
x: X,
|
||||
}
|
||||
@@ -77,9 +84,9 @@ fn test_gen() {
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct NoBounds<T> {
|
||||
t: T,
|
||||
option: Option<T>,
|
||||
option: StdOption<T>,
|
||||
boxed: Box<T>,
|
||||
option_boxed: Option<Box<T>>,
|
||||
option_boxed: StdOption<Box<T>>,
|
||||
}
|
||||
assert::<NoBounds<i32>>();
|
||||
|
||||
@@ -175,8 +182,8 @@ fn test_gen() {
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct OptionStatic<'a> {
|
||||
a: Option<&'a str>,
|
||||
b: Option<&'static str>,
|
||||
a: StdOption<&'a str>,
|
||||
b: StdOption<&'static str>,
|
||||
}
|
||||
assert_ser::<OptionStatic>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user