From 8f90eacf6c6335fbd925b1d663e46f4a7592ebba Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 16 Jul 2023 18:13:57 -0700 Subject: [PATCH 1/3] Delete inline attributes throughout test suite --- tests/test.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/test.rs b/tests/test.rs index e4708bfb3..acf5de480 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1452,7 +1452,6 @@ fn test_serialize_seq_with_no_len() { where T: ser::Serialize, { - #[inline] fn serialize(&self, serializer: S) -> Result where S: ser::Serializer, @@ -1479,7 +1478,6 @@ fn test_serialize_seq_with_no_len() { formatter.write_str("array") } - #[inline] fn visit_unit(self) -> Result, E> where E: de::Error, @@ -1487,7 +1485,6 @@ fn test_serialize_seq_with_no_len() { Ok(MyVec(Vec::new())) } - #[inline] fn visit_seq(self, mut visitor: V) -> Result, V::Error> where V: de::SeqAccess<'de>, @@ -1538,7 +1535,6 @@ fn test_serialize_map_with_no_len() { K: ser::Serialize + Ord, V: ser::Serialize, { - #[inline] fn serialize(&self, serializer: S) -> Result where S: ser::Serializer, @@ -1566,7 +1562,6 @@ fn test_serialize_map_with_no_len() { formatter.write_str("map") } - #[inline] fn visit_unit(self) -> Result, E> where E: de::Error, @@ -1574,7 +1569,6 @@ fn test_serialize_map_with_no_len() { Ok(MyMap(BTreeMap::new())) } - #[inline] fn visit_map(self, mut visitor: Visitor) -> Result, Visitor::Error> where Visitor: de::MapAccess<'de>, From 8e8db8ce0cf066d8ef4cbe0167c3a97d18a49674 Mon Sep 17 00:00:00 2001 From: Daria Sukhonina Date: Wed, 26 Jul 2023 22:04:37 +0300 Subject: [PATCH 2/3] Implement IntoDeserializer for &Value --- src/value/de.rs | 8 ++++++++ tests/test.rs | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/value/de.rs b/src/value/de.rs index 3f14abb3b..2090dd009 100644 --- a/src/value/de.rs +++ b/src/value/de.rs @@ -482,6 +482,14 @@ impl<'de> IntoDeserializer<'de, Error> for Value { } } +impl<'de> IntoDeserializer<'de, Error> for &'de Value { + type Deserializer = Self; + + fn into_deserializer(self) -> Self::Deserializer { + self + } +} + struct VariantDeserializer { value: Option, } diff --git a/tests/test.rs b/tests/test.rs index acf5de480..8d9a5942a 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -2472,6 +2472,12 @@ fn test_value_into_deserializer() { let mut map = BTreeMap::new(); map.insert("inner", json!({ "string": "Hello World" })); + let outer = Outer::deserialize(serde::de::value::MapDeserializer::new( + map.iter().map(|(k, v)| (*k, v)), + )) + .unwrap(); + assert_eq!(outer.inner.string, "Hello World"); + let outer = Outer::deserialize(map.into_deserializer()).unwrap(); assert_eq!(outer.inner.string, "Hello World"); } From ab084832926cf7d733785c8801aa4fcf96523956 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 26 Jul 2023 12:30:09 -0700 Subject: [PATCH 3/3] Release 1.0.104 --- Cargo.toml | 2 +- src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7893b2c4d..7fd2b36d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "serde_json" -version = "1.0.103" # remember to update html_root_url +version = "1.0.104" # remember to update html_root_url authors = ["Erick Tryzelaar ", "David Tolnay "] categories = ["encoding", "parser-implementations", "no-std"] description = "A JSON serialization file format" diff --git a/src/lib.rs b/src/lib.rs index 974d673cc..c322ed8a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -300,7 +300,7 @@ //! [macro]: crate::json //! [`serde-json-core`]: https://github.com/rust-embedded-community/serde-json-core -#![doc(html_root_url = "https://docs.rs/serde_json/1.0.103")] +#![doc(html_root_url = "https://docs.rs/serde_json/1.0.104")] // Ignored clippy lints #![allow( clippy::collapsible_else_if,