summaryrefslogtreecommitdiffstats
path: root/vendor/serde
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/serde')
-rw-r--r--vendor/serde/.cargo-checksum.json2
-rw-r--r--vendor/serde/Cargo.toml4
-rw-r--r--vendor/serde/src/de/impls.rs11
-rw-r--r--vendor/serde/src/lib.rs2
-rw-r--r--vendor/serde/src/private/de.rs154
5 files changed, 65 insertions, 108 deletions
diff --git a/vendor/serde/.cargo-checksum.json b/vendor/serde/.cargo-checksum.json
index 7bef9d09b..6f4146ff1 100644
--- a/vendor/serde/.cargo-checksum.json
+++ b/vendor/serde/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"08f34b0ade602046b909ac209f438ca4271b49084fca87c30cd4f0c39dcf333d","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"13c66875efb67f64fdec817725f34ceb07913e1ebea4adc240868d2ed581d3da","build.rs":"976e089a5f74fc03e23465744bcc02b3b600a59f1c098da60c29d3979c5b35df","crates-io.md":"ee22254ee64c3189eef3e707c8d75dc66a8df2a7ee9e518d95238950780ec387","src/de/format.rs":"84f902fd4c3be66e81ac01d5b21cd876113c16f9890ff8bab5faa0d085386294","src/de/ignored_any.rs":"967184c86707c99b77a1cfb218dfc823f560fae227b6635aee6af19ee82962f5","src/de/impls.rs":"60c481b12dc3bb41810302f6979d7d9a8fa47f4467617d511e283a6a889a7428","src/de/mod.rs":"71198e80e4c64aa686b5ceb6e8bce10db20845a87a30fa14227ecbe365a046d5","src/de/seed.rs":"e8cf0233afe0af5b8fb9e4c94f301c92729c5ba417280af9e2201b732e374a72","src/de/utf8.rs":"f17524ee0af98ec3abcfd7d0b812fbd1033263bd8e2ce2f57c1e1999ce153558","src/de/value.rs":"aa5055923e2c3fd1c1f1abdfb380a1d63d07cf4d602ef62d2df2b7da33dd8c81","src/integer128.rs":"ca49591abde2d8c4f582174533fee28f0fa9139e5d71bf22b25a6b175f8abccc","src/lib.rs":"13a3d8b17734fc99288eb9aacf13e9f03c9d2926f80fc0cc626790a6c040e0e2","src/macros.rs":"3d695a51f0a07f9f719dcb5620012c21a1b084c06a6283349cabf574ceba8123","src/private/de.rs":"a85efe9af4f5629ac7d946af56e20fbc184df6ac40a6cfe47bf3997a95b2ea20","src/private/doc.rs":"e9801a43c3088fccd5f1fac76416698f948e65b647024aa9da17d673e1e8c217","src/private/mod.rs":"37b204775e572396515477b393ce793b2579de48e5971e6f596ba3723c489fd6","src/private/ser.rs":"57fbff98429e870da86edcf61c0831caaa3b708c0c32e3038c4b2179e8dff73e","src/private/size_hint.rs":"605521227e9ba3100fbb9d5ea7fd5853385097c35015ce6908bd5f1ea20d59ad","src/ser/fmt.rs":"7827ed07fd8897e6324f75625ba0c926a4c4e7ec2914cd067391ce54d942ac7b","src/ser/impls.rs":"46229722b7f0d8c4f01c43567c765608bf2c1974a5f24ce2525815c5bfd42ff5","src/ser/impossible.rs":"db17913522c1c27389c5a085113911353b9813c1b116518681362e7c8b692c3a","src/ser/mod.rs":"e1e6c764837c70b6410dcf1949a0dae1b4b4ffce65b87607d3d173b612e9bccf","src/std_error.rs":"3aac687856c035517fae44ed2906dd4a1e3184bae4bf613adcdeb73f74126c57"},"package":"bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c"} \ No newline at end of file
+{"files":{"Cargo.toml":"fade947bc8291920e3346efae5931e3a086e273965ae4e5d53defeec4b83abcd","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"13c66875efb67f64fdec817725f34ceb07913e1ebea4adc240868d2ed581d3da","build.rs":"976e089a5f74fc03e23465744bcc02b3b600a59f1c098da60c29d3979c5b35df","crates-io.md":"ee22254ee64c3189eef3e707c8d75dc66a8df2a7ee9e518d95238950780ec387","src/de/format.rs":"84f902fd4c3be66e81ac01d5b21cd876113c16f9890ff8bab5faa0d085386294","src/de/ignored_any.rs":"967184c86707c99b77a1cfb218dfc823f560fae227b6635aee6af19ee82962f5","src/de/impls.rs":"e8440409d11b73433b7ad8496cebf8be8f56160e90cf8328bb1d33318db40dea","src/de/mod.rs":"71198e80e4c64aa686b5ceb6e8bce10db20845a87a30fa14227ecbe365a046d5","src/de/seed.rs":"e8cf0233afe0af5b8fb9e4c94f301c92729c5ba417280af9e2201b732e374a72","src/de/utf8.rs":"f17524ee0af98ec3abcfd7d0b812fbd1033263bd8e2ce2f57c1e1999ce153558","src/de/value.rs":"aa5055923e2c3fd1c1f1abdfb380a1d63d07cf4d602ef62d2df2b7da33dd8c81","src/integer128.rs":"ca49591abde2d8c4f582174533fee28f0fa9139e5d71bf22b25a6b175f8abccc","src/lib.rs":"0468f054b00478e434623d2ec9f1ca3b2d2cee17b3346fe41362370714e6087f","src/macros.rs":"3d695a51f0a07f9f719dcb5620012c21a1b084c06a6283349cabf574ceba8123","src/private/de.rs":"9a6fd642aa50530144ad54ec6072d032026b8b17b15017f26c35718e63205a26","src/private/doc.rs":"e9801a43c3088fccd5f1fac76416698f948e65b647024aa9da17d673e1e8c217","src/private/mod.rs":"37b204775e572396515477b393ce793b2579de48e5971e6f596ba3723c489fd6","src/private/ser.rs":"57fbff98429e870da86edcf61c0831caaa3b708c0c32e3038c4b2179e8dff73e","src/private/size_hint.rs":"605521227e9ba3100fbb9d5ea7fd5853385097c35015ce6908bd5f1ea20d59ad","src/ser/fmt.rs":"7827ed07fd8897e6324f75625ba0c926a4c4e7ec2914cd067391ce54d942ac7b","src/ser/impls.rs":"46229722b7f0d8c4f01c43567c765608bf2c1974a5f24ce2525815c5bfd42ff5","src/ser/impossible.rs":"db17913522c1c27389c5a085113911353b9813c1b116518681362e7c8b692c3a","src/ser/mod.rs":"e1e6c764837c70b6410dcf1949a0dae1b4b4ffce65b87607d3d173b612e9bccf","src/std_error.rs":"3aac687856c035517fae44ed2906dd4a1e3184bae4bf613adcdeb73f74126c57"},"package":"9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d"} \ No newline at end of file
diff --git a/vendor/serde/Cargo.toml b/vendor/serde/Cargo.toml
index 3b273a1df..6d0c021e0 100644
--- a/vendor/serde/Cargo.toml
+++ b/vendor/serde/Cargo.toml
@@ -12,7 +12,7 @@
[package]
rust-version = "1.19"
name = "serde"
-version = "1.0.160"
+version = "1.0.164"
authors = [
"Erick Tryzelaar <erick.tryzelaar@gmail.com>",
"David Tolnay <dtolnay@gmail.com>",
@@ -56,7 +56,7 @@ features = [
doc-scrape-examples = false
[dependencies.serde_derive]
-version = "=1.0.160"
+version = "=1.0.164"
optional = true
[dev-dependencies.serde_derive]
diff --git a/vendor/serde/src/de/impls.rs b/vendor/serde/src/de/impls.rs
index a2e2c4856..7dd3bc327 100644
--- a/vendor/serde/src/de/impls.rs
+++ b/vendor/serde/src/de/impls.rs
@@ -994,7 +994,8 @@ seq_impl!(
HashSet::clear,
HashSet::with_capacity_and_hasher(size_hint::cautious(seq.size_hint()), S::default()),
HashSet::reserve,
- HashSet::insert);
+ HashSet::insert
+);
#[cfg(any(feature = "std", feature = "alloc"))]
seq_impl!(
@@ -1409,16 +1410,14 @@ macro_rules! map_impl {
}
#[cfg(any(feature = "std", feature = "alloc"))]
-map_impl!(
- BTreeMap<K: Ord, V>,
- map,
- BTreeMap::new());
+map_impl!(BTreeMap<K: Ord, V>, map, BTreeMap::new());
#[cfg(feature = "std")]
map_impl!(
HashMap<K: Eq + Hash, V, S: BuildHasher + Default>,
map,
- HashMap::with_capacity_and_hasher(size_hint::cautious(map.size_hint()), S::default()));
+ HashMap::with_capacity_and_hasher(size_hint::cautious(map.size_hint()), S::default())
+);
////////////////////////////////////////////////////////////////////////////////
diff --git a/vendor/serde/src/lib.rs b/vendor/serde/src/lib.rs
index 8db200c6f..d788d6189 100644
--- a/vendor/serde/src/lib.rs
+++ b/vendor/serde/src/lib.rs
@@ -93,7 +93,7 @@
////////////////////////////////////////////////////////////////////////////////
// Serde types in rustdoc of other crates get linked to here.
-#![doc(html_root_url = "https://docs.rs/serde/1.0.160")]
+#![doc(html_root_url = "https://docs.rs/serde/1.0.164")]
// Support using Serde without the standard library!
#![cfg_attr(not(feature = "std"), no_std)]
// Unstable functionality only if the user asks for it. For tracking and
diff --git a/vendor/serde/src/private/de.rs b/vendor/serde/src/private/de.rs
index e9c693d4d..f0a0ee683 100644
--- a/vendor/serde/src/private/de.rs
+++ b/vendor/serde/src/private/de.rs
@@ -982,9 +982,16 @@ mod content {
where
E: de::Error,
{
- if field == self.tag {
+ self.visit_bytes(field.as_bytes())
+ }
+
+ fn visit_bytes<E>(self, field: &[u8]) -> Result<Self::Value, E>
+ where
+ E: de::Error,
+ {
+ if field == self.tag.as_bytes() {
Ok(TagContentOtherField::Tag)
- } else if field == self.content {
+ } else if field == self.content.as_bytes() {
Ok(TagContentOtherField::Content)
} else {
Ok(TagContentOtherField::Other)
@@ -2186,6 +2193,14 @@ mod content {
}
}
+ impl<'a, 'de: 'a, E> Copy for ContentRefDeserializer<'a, 'de, E> {}
+
+ impl<'a, 'de: 'a, E> Clone for ContentRefDeserializer<'a, 'de, E> {
+ fn clone(&self) -> Self {
+ *self
+ }
+ }
+
struct EnumRefDeserializer<'a, 'de: 'a, E>
where
E: de::Error,
@@ -2731,11 +2746,7 @@ where
where
V: Visitor<'de>,
{
- visitor.visit_map(FlatInternallyTaggedAccess {
- iter: self.0.iter_mut(),
- pending: None,
- _marker: PhantomData,
- })
+ self.deserialize_map(visitor)
}
fn deserialize_enum<V>(
@@ -2747,17 +2758,8 @@ where
where
V: Visitor<'de>,
{
- for item in self.0.iter_mut() {
- // items in the vector are nulled out when used. So we can only use
- // an item if it's still filled in and if the field is one we care
- // about.
- let use_item = match *item {
- None => false,
- Some((ref c, _)) => c.as_str().map_or(false, |x| variants.contains(&x)),
- };
-
- if use_item {
- let (key, value) = item.take().unwrap();
+ for entry in self.0.iter_mut() {
+ if let Some((key, value)) = flat_map_take_entry(entry, variants) {
return visitor.visit_enum(EnumDeserializer::new(key, Some(value)));
}
}
@@ -2772,7 +2774,11 @@ where
where
V: Visitor<'de>,
{
- visitor.visit_map(FlatMapAccess::new(self.0.iter()))
+ visitor.visit_map(FlatMapAccess {
+ iter: self.0.iter(),
+ pending_content: None,
+ _marker: PhantomData,
+ })
}
fn deserialize_struct<V>(
@@ -2784,7 +2790,12 @@ where
where
V: Visitor<'de>,
{
- visitor.visit_map(FlatStructAccess::new(self.0.iter_mut(), fields))
+ visitor.visit_map(FlatStructAccess {
+ iter: self.0.iter_mut(),
+ pending_content: None,
+ fields: fields,
+ _marker: PhantomData,
+ })
}
fn deserialize_newtype_struct<V>(self, _name: &str, visitor: V) -> Result<V::Value, Self::Error>
@@ -2838,26 +2849,13 @@ where
}
#[cfg(any(feature = "std", feature = "alloc"))]
-pub struct FlatMapAccess<'a, 'de: 'a, E> {
+struct FlatMapAccess<'a, 'de: 'a, E> {
iter: slice::Iter<'a, Option<(Content<'de>, Content<'de>)>>,
pending_content: Option<&'a Content<'de>>,
_marker: PhantomData<E>,
}
#[cfg(any(feature = "std", feature = "alloc"))]
-impl<'a, 'de, E> FlatMapAccess<'a, 'de, E> {
- fn new(
- iter: slice::Iter<'a, Option<(Content<'de>, Content<'de>)>>,
- ) -> FlatMapAccess<'a, 'de, E> {
- FlatMapAccess {
- iter: iter,
- pending_content: None,
- _marker: PhantomData,
- }
- }
-}
-
-#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, 'de, E> MapAccess<'de> for FlatMapAccess<'a, 'de, E>
where
E: Error,
@@ -2871,6 +2869,10 @@ where
for item in &mut self.iter {
// Items in the vector are nulled out when used by a struct.
if let Some((ref key, ref content)) = *item {
+ // Do not take(), instead borrow this entry. The internally tagged
+ // enum does its own buffering so we can't tell whether this entry
+ // is going to be consumed. Borrowing here leaves the entry
+ // available for later flattened fields.
self.pending_content = Some(content);
return seed.deserialize(ContentRefDeserializer::new(key)).map(Some);
}
@@ -2890,7 +2892,7 @@ where
}
#[cfg(any(feature = "std", feature = "alloc"))]
-pub struct FlatStructAccess<'a, 'de: 'a, E> {
+struct FlatStructAccess<'a, 'de: 'a, E> {
iter: slice::IterMut<'a, Option<(Content<'de>, Content<'de>)>>,
pending_content: Option<Content<'de>>,
fields: &'static [&'static str],
@@ -2898,21 +2900,6 @@ pub struct FlatStructAccess<'a, 'de: 'a, E> {
}
#[cfg(any(feature = "std", feature = "alloc"))]
-impl<'a, 'de, E> FlatStructAccess<'a, 'de, E> {
- fn new(
- iter: slice::IterMut<'a, Option<(Content<'de>, Content<'de>)>>,
- fields: &'static [&'static str],
- ) -> FlatStructAccess<'a, 'de, E> {
- FlatStructAccess {
- iter: iter,
- pending_content: None,
- fields: fields,
- _marker: PhantomData,
- }
- }
-}
-
-#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, 'de, E> MapAccess<'de> for FlatStructAccess<'a, 'de, E>
where
E: Error,
@@ -2923,17 +2910,8 @@ where
where
T: DeserializeSeed<'de>,
{
- while let Some(item) = self.iter.next() {
- // items in the vector are nulled out when used. So we can only use
- // an item if it's still filled in and if the field is one we care
- // about. In case we do not know which fields we want, we take them all.
- let use_item = match *item {
- None => false,
- Some((ref c, _)) => c.as_str().map_or(false, |key| self.fields.contains(&key)),
- };
-
- if use_item {
- let (key, content) = item.take().unwrap();
+ for entry in self.iter.by_ref() {
+ if let Some((key, content)) = flat_map_take_entry(entry, self.fields) {
self.pending_content = Some(content);
return seed.deserialize(ContentDeserializer::new(key)).map(Some);
}
@@ -2952,44 +2930,24 @@ where
}
}
+/// Claims one key-value pair from a FlatMapDeserializer's field buffer if the
+/// field name matches any of the recognized ones.
#[cfg(any(feature = "std", feature = "alloc"))]
-pub struct FlatInternallyTaggedAccess<'a, 'de: 'a, E> {
- iter: slice::IterMut<'a, Option<(Content<'de>, Content<'de>)>>,
- pending: Option<&'a Content<'de>>,
- _marker: PhantomData<E>,
-}
-
-#[cfg(any(feature = "std", feature = "alloc"))]
-impl<'a, 'de, E> MapAccess<'de> for FlatInternallyTaggedAccess<'a, 'de, E>
-where
- E: Error,
-{
- type Error = E;
-
- fn next_key_seed<T>(&mut self, seed: T) -> Result<Option<T::Value>, Self::Error>
- where
- T: DeserializeSeed<'de>,
- {
- for item in &mut self.iter {
- if let Some((ref key, ref content)) = *item {
- // Do not take(), instead borrow this entry. The internally tagged
- // enum does its own buffering so we can't tell whether this entry
- // is going to be consumed. Borrowing here leaves the entry
- // available for later flattened fields.
- self.pending = Some(content);
- return seed.deserialize(ContentRefDeserializer::new(key)).map(Some);
- }
- }
- Ok(None)
- }
+fn flat_map_take_entry<'de>(
+ entry: &mut Option<(Content<'de>, Content<'de>)>,
+ recognized: &[&str],
+) -> Option<(Content<'de>, Content<'de>)> {
+ // Entries in the FlatMapDeserializer buffer are nulled out as they get
+ // claimed for deserialization. We only use an entry if it is still present
+ // and if the field is one recognized by the current data structure.
+ let is_recognized = match entry {
+ None => false,
+ Some((k, _v)) => k.as_str().map_or(false, |name| recognized.contains(&name)),
+ };
- fn next_value_seed<T>(&mut self, seed: T) -> Result<T::Value, Self::Error>
- where
- T: DeserializeSeed<'de>,
- {
- match self.pending.take() {
- Some(value) => seed.deserialize(ContentRefDeserializer::new(value)),
- None => panic!("value is missing"),
- }
+ if is_recognized {
+ entry.take()
+ } else {
+ None
}
}