summaryrefslogtreecommitdiffstats
path: root/vendor/serde/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:24 +0000
commit023939b627b7dc93b01471f7d41fb8553ddb4ffa (patch)
tree60fc59477c605c72b0a1051409062ddecc43f877 /vendor/serde/src
parentAdding debian version 1.72.1+dfsg1-1. (diff)
downloadrustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.tar.xz
rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/serde/src')
-rw-r--r--vendor/serde/src/de/ignored_any.rs9
-rw-r--r--vendor/serde/src/de/impls.rs323
-rw-r--r--vendor/serde/src/de/mod.rs58
-rw-r--r--vendor/serde/src/de/utf8.rs2
-rw-r--r--vendor/serde/src/de/value.rs38
-rw-r--r--vendor/serde/src/integer128.rs6
-rw-r--r--vendor/serde/src/lib.rs4
-rw-r--r--vendor/serde/src/macros.rs9
-rw-r--r--vendor/serde/src/private/de.rs133
-rw-r--r--vendor/serde/src/private/ser.rs36
-rw-r--r--vendor/serde/src/private/size_hint.rs14
-rw-r--r--vendor/serde/src/ser/fmt.rs5
-rw-r--r--vendor/serde/src/ser/impls.rs36
-rw-r--r--vendor/serde/src/ser/impossible.rs2
-rw-r--r--vendor/serde/src/ser/mod.rs124
-rw-r--r--vendor/serde/src/std_error.rs6
16 files changed, 566 insertions, 239 deletions
diff --git a/vendor/serde/src/de/ignored_any.rs b/vendor/serde/src/de/ignored_any.rs
index 9ed438e79..01555a29f 100644
--- a/vendor/serde/src/de/ignored_any.rs
+++ b/vendor/serde/src/de/ignored_any.rs
@@ -10,13 +10,12 @@ use de::{
/// any type, except that it does not store any information about the data that
/// gets deserialized.
///
-/// ```edition2018
-/// use std::fmt;
-/// use std::marker::PhantomData;
-///
+/// ```edition2021
/// use serde::de::{
/// self, Deserialize, DeserializeSeed, Deserializer, IgnoredAny, SeqAccess, Visitor,
/// };
+/// use std::fmt;
+/// use std::marker::PhantomData;
///
/// /// A seed that can be used to deserialize only the `n`th element of a sequence
/// /// while efficiently discarding elements of any type before or after index `n`.
@@ -108,7 +107,7 @@ use de::{
/// # Ok(())
/// # }
/// ```
-#[derive(Copy, Clone, Debug, Default)]
+#[derive(Copy, Clone, Debug, Default, PartialEq)]
pub struct IgnoredAny;
impl<'de> Visitor<'de> for IgnoredAny {
diff --git a/vendor/serde/src/de/impls.rs b/vendor/serde/src/de/impls.rs
index 7dd3bc327..12fbdfdb3 100644
--- a/vendor/serde/src/de/impls.rs
+++ b/vendor/serde/src/de/impls.rs
@@ -681,8 +681,8 @@ impl<'de> Visitor<'de> for CStringVisitor {
where
A: SeqAccess<'de>,
{
- let len = size_hint::cautious(seq.size_hint());
- let mut values = Vec::with_capacity(len);
+ let capacity = size_hint::cautious::<u8>(seq.size_hint());
+ let mut values = Vec::<u8>::with_capacity(capacity);
while let Some(value) = try!(seq.next_element()) {
values.push(value);
@@ -936,7 +936,7 @@ macro_rules! seq_impl {
A: SeqAccess<'de>,
{
$clear(&mut self.0);
- $reserve(&mut self.0, size_hint::cautious($access.size_hint()));
+ $reserve(&mut self.0, size_hint::cautious::<T>($access.size_hint()));
// FIXME: try to overwrite old values here? (Vec, VecDeque, LinkedList)
while let Some(value) = try!($access.next_element()) {
@@ -962,7 +962,7 @@ seq_impl!(
BinaryHeap<T: Ord>,
seq,
BinaryHeap::clear,
- BinaryHeap::with_capacity(size_hint::cautious(seq.size_hint())),
+ BinaryHeap::with_capacity(size_hint::cautious::<T>(seq.size_hint())),
BinaryHeap::reserve,
BinaryHeap::push
);
@@ -992,7 +992,7 @@ seq_impl!(
HashSet<T: Eq + Hash, S: BuildHasher + Default>,
seq,
HashSet::clear,
- HashSet::with_capacity_and_hasher(size_hint::cautious(seq.size_hint()), S::default()),
+ HashSet::with_capacity_and_hasher(size_hint::cautious::<T>(seq.size_hint()), S::default()),
HashSet::reserve,
HashSet::insert
);
@@ -1002,7 +1002,7 @@ seq_impl!(
VecDeque<T>,
seq,
VecDeque::clear,
- VecDeque::with_capacity(size_hint::cautious(seq.size_hint())),
+ VecDeque::with_capacity(size_hint::cautious::<T>(seq.size_hint())),
VecDeque::reserve,
VecDeque::push_back
);
@@ -1036,7 +1036,8 @@ where
where
A: SeqAccess<'de>,
{
- let mut values = Vec::with_capacity(size_hint::cautious(seq.size_hint()));
+ let capacity = size_hint::cautious::<T>(seq.size_hint());
+ let mut values = Vec::<T>::with_capacity(capacity);
while let Some(value) = try!(seq.next_element()) {
values.push(value);
@@ -1072,7 +1073,7 @@ where
where
A: SeqAccess<'de>,
{
- let hint = size_hint::cautious(seq.size_hint());
+ let hint = size_hint::cautious::<T>(seq.size_hint());
if let Some(additional) = hint.checked_sub(self.0.len()) {
self.0.reserve(additional);
}
@@ -1416,7 +1417,7 @@ map_impl!(BTreeMap<K: Ord, V>, map, BTreeMap::new());
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::<(K, V)>(map.size_hint()), S::default())
);
////////////////////////////////////////////////////////////////////////////////
@@ -1450,7 +1451,7 @@ macro_rules! variant_identifier {
$($variant),*
}
- static $variants_name: &'static [&'static str] = &[$(stringify!($variant)),*];
+ static $variants_name: &[&str] = &[$(stringify!($variant)),*];
impl<'de> Deserialize<'de> for $name_kind {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
@@ -1587,7 +1588,7 @@ macro_rules! parse_socket_impl {
if deserializer.is_human_readable() {
deserializer.deserialize_str(FromStrVisitor::new($expecting))
} else {
- <(_, u16)>::deserialize(deserializer).map(|(ip, port)| $new(ip, port))
+ <(_, u16)>::deserialize(deserializer).map($new)
}
}
}
@@ -1614,12 +1615,10 @@ impl<'de> Deserialize<'de> for net::SocketAddr {
}
#[cfg(feature = "std")]
-parse_socket_impl!("IPv4 socket address" net::SocketAddrV4, net::SocketAddrV4::new);
+parse_socket_impl!("IPv4 socket address" net::SocketAddrV4, |(ip, port)| net::SocketAddrV4::new(ip, port));
#[cfg(feature = "std")]
-parse_socket_impl!("IPv6 socket address" net::SocketAddrV6, |ip, port| net::SocketAddrV6::new(
- ip, port, 0, 0
-));
+parse_socket_impl!("IPv6 socket address" net::SocketAddrV6, |(ip, port)| net::SocketAddrV6::new(ip, port, 0, 0));
////////////////////////////////////////////////////////////////////////////////
@@ -2098,7 +2097,7 @@ impl<'de> Deserialize<'de> for Duration {
}
}
- const FIELDS: &'static [&'static str] = &["secs", "nanos"];
+ const FIELDS: &[&str] = &["secs", "nanos"];
deserializer.deserialize_struct("Duration", FIELDS, DurationVisitor)
}
}
@@ -2240,7 +2239,7 @@ impl<'de> Deserialize<'de> for SystemTime {
}
}
- const FIELDS: &'static [&'static str] = &["secs_since_epoch", "nanos_since_epoch"];
+ const FIELDS: &[&str] = &["secs_since_epoch", "nanos_since_epoch"];
let duration = try!(deserializer.deserialize_struct("SystemTime", FIELDS, DurationVisitor));
#[cfg(not(no_systemtime_checked_add))]
let ret = UNIX_EPOCH
@@ -2258,9 +2257,9 @@ impl<'de> Deserialize<'de> for SystemTime {
//
// #[derive(Deserialize)]
// #[serde(deny_unknown_fields)]
-// struct Range {
-// start: u64,
-// end: u32,
+// struct Range<Idx> {
+// start: Idx,
+// end: Idx,
// }
impl<'de, Idx> Deserialize<'de> for Range<Idx>
where
@@ -2308,7 +2307,7 @@ mod range {
use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};
- pub const FIELDS: &'static [&'static str] = &["start", "end"];
+ pub const FIELDS: &[&str] = &["start", "end"];
// If this were outside of the serde crate, it would just use:
//
@@ -2434,6 +2433,282 @@ mod range {
////////////////////////////////////////////////////////////////////////////////
+// Similar to:
+//
+// #[derive(Deserialize)]
+// #[serde(deny_unknown_fields)]
+// struct RangeFrom<Idx> {
+// start: Idx,
+// }
+impl<'de, Idx> Deserialize<'de> for RangeFrom<Idx>
+where
+ Idx: Deserialize<'de>,
+{
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: Deserializer<'de>,
+ {
+ let start = try!(deserializer.deserialize_struct(
+ "RangeFrom",
+ range_from::FIELDS,
+ range_from::RangeFromVisitor {
+ expecting: "struct RangeFrom",
+ phantom: PhantomData,
+ },
+ ));
+ Ok(start..)
+ }
+}
+
+mod range_from {
+ use lib::*;
+
+ use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};
+
+ pub const FIELDS: &[&str] = &["end"];
+
+ // If this were outside of the serde crate, it would just use:
+ //
+ // #[derive(Deserialize)]
+ // #[serde(field_identifier, rename_all = "lowercase")]
+ enum Field {
+ End,
+ }
+
+ impl<'de> Deserialize<'de> for Field {
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: Deserializer<'de>,
+ {
+ struct FieldVisitor;
+
+ impl<'de> Visitor<'de> for FieldVisitor {
+ type Value = Field;
+
+ fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("`end`")
+ }
+
+ fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
+ where
+ E: Error,
+ {
+ match value {
+ "end" => Ok(Field::End),
+ _ => Err(Error::unknown_field(value, FIELDS)),
+ }
+ }
+
+ fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
+ where
+ E: Error,
+ {
+ match value {
+ b"end" => Ok(Field::End),
+ _ => {
+ let value = ::__private::from_utf8_lossy(value);
+ Err(Error::unknown_field(&*value, FIELDS))
+ }
+ }
+ }
+ }
+
+ deserializer.deserialize_identifier(FieldVisitor)
+ }
+ }
+
+ pub struct RangeFromVisitor<Idx> {
+ pub expecting: &'static str,
+ pub phantom: PhantomData<Idx>,
+ }
+
+ impl<'de, Idx> Visitor<'de> for RangeFromVisitor<Idx>
+ where
+ Idx: Deserialize<'de>,
+ {
+ type Value = Idx;
+
+ fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str(self.expecting)
+ }
+
+ fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
+ where
+ A: SeqAccess<'de>,
+ {
+ let end: Idx = match try!(seq.next_element()) {
+ Some(value) => value,
+ None => {
+ return Err(Error::invalid_length(0, &self));
+ }
+ };
+ Ok(end)
+ }
+
+ fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
+ where
+ A: MapAccess<'de>,
+ {
+ let mut end: Option<Idx> = None;
+ while let Some(key) = try!(map.next_key()) {
+ match key {
+ Field::End => {
+ if end.is_some() {
+ return Err(<A::Error as Error>::duplicate_field("end"));
+ }
+ end = Some(try!(map.next_value()));
+ }
+ }
+ }
+ let end = match end {
+ Some(end) => end,
+ None => return Err(<A::Error as Error>::missing_field("end")),
+ };
+ Ok(end)
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+// Similar to:
+//
+// #[derive(Deserialize)]
+// #[serde(deny_unknown_fields)]
+// struct RangeTo<Idx> {
+// start: Idx,
+// }
+impl<'de, Idx> Deserialize<'de> for RangeTo<Idx>
+where
+ Idx: Deserialize<'de>,
+{
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: Deserializer<'de>,
+ {
+ let end = try!(deserializer.deserialize_struct(
+ "RangeTo",
+ range_to::FIELDS,
+ range_to::RangeToVisitor {
+ expecting: "struct RangeTo",
+ phantom: PhantomData,
+ },
+ ));
+ Ok(..end)
+ }
+}
+
+mod range_to {
+ use lib::*;
+
+ use de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor};
+
+ pub const FIELDS: &[&str] = &["start"];
+
+ // If this were outside of the serde crate, it would just use:
+ //
+ // #[derive(Deserialize)]
+ // #[serde(field_identifier, rename_all = "lowercase")]
+ enum Field {
+ Start,
+ }
+
+ impl<'de> Deserialize<'de> for Field {
+ fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
+ where
+ D: Deserializer<'de>,
+ {
+ struct FieldVisitor;
+
+ impl<'de> Visitor<'de> for FieldVisitor {
+ type Value = Field;
+
+ fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("`start`")
+ }
+
+ fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
+ where
+ E: Error,
+ {
+ match value {
+ "start" => Ok(Field::Start),
+ _ => Err(Error::unknown_field(value, FIELDS)),
+ }
+ }
+
+ fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
+ where
+ E: Error,
+ {
+ match value {
+ b"start" => Ok(Field::Start),
+ _ => {
+ let value = ::__private::from_utf8_lossy(value);
+ Err(Error::unknown_field(&*value, FIELDS))
+ }
+ }
+ }
+ }
+
+ deserializer.deserialize_identifier(FieldVisitor)
+ }
+ }
+
+ pub struct RangeToVisitor<Idx> {
+ pub expecting: &'static str,
+ pub phantom: PhantomData<Idx>,
+ }
+
+ impl<'de, Idx> Visitor<'de> for RangeToVisitor<Idx>
+ where
+ Idx: Deserialize<'de>,
+ {
+ type Value = Idx;
+
+ fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str(self.expecting)
+ }
+
+ fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
+ where
+ A: SeqAccess<'de>,
+ {
+ let start: Idx = match try!(seq.next_element()) {
+ Some(value) => value,
+ None => {
+ return Err(Error::invalid_length(0, &self));
+ }
+ };
+ Ok(start)
+ }
+
+ fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error>
+ where
+ A: MapAccess<'de>,
+ {
+ let mut start: Option<Idx> = None;
+ while let Some(key) = try!(map.next_key()) {
+ match key {
+ Field::Start => {
+ if start.is_some() {
+ return Err(<A::Error as Error>::duplicate_field("start"));
+ }
+ start = Some(try!(map.next_value()));
+ }
+ }
+ }
+ let start = match start {
+ Some(start) => start,
+ None => return Err(<A::Error as Error>::missing_field("start")),
+ };
+ Ok(start)
+ }
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
#[cfg(any(not(no_ops_bound), all(feature = "std", not(no_collections_bound))))]
impl<'de, T> Deserialize<'de> for Bound<T>
where
@@ -2534,7 +2809,7 @@ where
}
}
- const VARIANTS: &'static [&'static str] = &["Unbounded", "Included", "Excluded"];
+ const VARIANTS: &[&str] = &["Unbounded", "Included", "Excluded"];
deserializer.deserialize_enum("Bound", VARIANTS, BoundVisitor(PhantomData))
}
@@ -2642,7 +2917,7 @@ where
}
}
- const VARIANTS: &'static [&'static str] = &["Ok", "Err"];
+ const VARIANTS: &[&str] = &["Ok", "Err"];
deserializer.deserialize_enum("Result", VARIANTS, ResultVisitor(PhantomData))
}
@@ -2708,7 +2983,7 @@ struct FromStrVisitor<T> {
impl<T> FromStrVisitor<T> {
fn new(expecting: &'static str) -> Self {
FromStrVisitor {
- expecting: expecting,
+ expecting,
ty: PhantomData,
}
}
diff --git a/vendor/serde/src/de/mod.rs b/vendor/serde/src/de/mod.rs
index ca29ec610..a04ecf77d 100644
--- a/vendor/serde/src/de/mod.rs
+++ b/vendor/serde/src/de/mod.rs
@@ -162,7 +162,7 @@ macro_rules! declare_error_trait {
///
/// The message should not be capitalized and should not end with a period.
///
- /// ```edition2018
+ /// ```edition2021
/// # use std::str::FromStr;
/// #
/// # struct IpAddr;
@@ -307,7 +307,7 @@ declare_error_trait!(Error: Sized + Debug + Display);
/// This is used as an argument to the `invalid_type`, `invalid_value`, and
/// `invalid_length` methods of the `Error` trait to build error messages.
///
-/// ```edition2018
+/// ```edition2021
/// # use std::fmt;
/// #
/// # use serde::de::{self, Unexpected, Visitor};
@@ -432,10 +432,9 @@ impl<'a> fmt::Display for Unexpected<'a> {
/// Within the context of a `Visitor` implementation, the `Visitor` itself
/// (`&self`) is an implementation of this trait.
///
-/// ```edition2018
-/// # use std::fmt;
-/// #
+/// ```edition2021
/// # use serde::de::{self, Unexpected, Visitor};
+/// # use std::fmt;
/// #
/// # struct Example;
/// #
@@ -457,7 +456,7 @@ impl<'a> fmt::Display for Unexpected<'a> {
///
/// Outside of a `Visitor`, `&"..."` can be used.
///
-/// ```edition2018
+/// ```edition2021
/// # use serde::de::{self, Unexpected};
/// #
/// # fn example<E>() -> Result<(), E>
@@ -465,7 +464,10 @@ impl<'a> fmt::Display for Unexpected<'a> {
/// # E: de::Error,
/// # {
/// # let v = true;
-/// return Err(de::Error::invalid_type(Unexpected::Bool(v), &"a negative integer"));
+/// return Err(de::Error::invalid_type(
+/// Unexpected::Bool(v),
+/// &"a negative integer",
+/// ));
/// # }
/// ```
pub trait Expected {
@@ -577,7 +579,7 @@ pub trait Deserialize<'de>: Sized {
/// from the input string, but a `from_reader` function may only deserialize
/// owned data.
///
-/// ```edition2018
+/// ```edition2021
/// # use serde::de::{Deserialize, DeserializeOwned};
/// # use std::io::{Read, Result};
/// #
@@ -616,7 +618,7 @@ impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {}
///
/// The canonical API for stateless deserialization looks like this:
///
-/// ```edition2018
+/// ```edition2021
/// # use serde::Deserialize;
/// #
/// # enum Error {}
@@ -630,7 +632,7 @@ impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {}
/// Adjusting an API like this to support stateful deserialization is a matter
/// of accepting a seed as input:
///
-/// ```edition2018
+/// ```edition2021
/// # use serde::de::DeserializeSeed;
/// #
/// # enum Error {}
@@ -663,12 +665,11 @@ impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {}
/// into it. This requires stateful deserialization using the `DeserializeSeed`
/// trait.
///
-/// ```edition2018
+/// ```edition2021
+/// use serde::de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor};
/// use std::fmt;
/// use std::marker::PhantomData;
///
-/// use serde::de::{Deserialize, DeserializeSeed, Deserializer, SeqAccess, Visitor};
-///
/// // A DeserializeSeed implementation that uses stateful deserialization to
/// // append array elements onto the end of an existing vector. The preexisting
/// // state ("seed") in this case is the Vec<T>. The `deserialize` method of
@@ -709,7 +710,7 @@ impl<T> DeserializeOwned for T where T: for<'de> Deserialize<'de> {}
/// {
/// // Decrease the number of reallocations if there are many elements
/// if let Some(size_hint) = seq.size_hint() {
-/// self.0.reserve(size_hint);
+/// self.0.reserve(size_hint);
/// }
///
/// // Visit each element in the inner array and push it onto
@@ -1158,7 +1159,7 @@ pub trait Deserializer<'de>: Sized {
/// human-readable one and binary formats like Postcard will prefer the
/// compact one.
///
- /// ```edition2018
+ /// ```edition2021
/// # use std::ops::Add;
/// # use std::str::FromStr;
/// #
@@ -1249,10 +1250,9 @@ pub trait Deserializer<'de>: Sized {
///
/// # Example
///
-/// ```edition2018
-/// # use std::fmt;
-/// #
+/// ```edition2021
/// # use serde::de::{self, Unexpected, Visitor};
+/// # use std::fmt;
/// #
/// /// A visitor that deserializes a long string - a string containing at least
/// /// some minimum number of bytes.
@@ -1290,7 +1290,7 @@ pub trait Visitor<'de>: Sized {
/// "an integer between 0 and 64". The message should not be capitalized and
/// should not end with a period.
///
- /// ```edition2018
+ /// ```edition2021
/// # use std::fmt;
/// #
/// # struct S {
@@ -2035,7 +2035,7 @@ pub trait VariantAccess<'de>: Sized {
/// If the data contains a different type of variant, the following
/// `invalid_type` error should be constructed:
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected};
/// #
/// # struct X;
@@ -2075,7 +2075,7 @@ pub trait VariantAccess<'de>: Sized {
/// If the data contains a different type of variant, the following
/// `invalid_type` error should be constructed:
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected};
/// #
/// # struct X;
@@ -2131,7 +2131,7 @@ pub trait VariantAccess<'de>: Sized {
/// If the data contains a different type of variant, the following
/// `invalid_type` error should be constructed:
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected};
/// #
/// # struct X;
@@ -2148,11 +2148,7 @@ pub trait VariantAccess<'de>: Sized {
/// # T: DeserializeSeed<'de>,
/// # { unimplemented!() }
/// #
- /// fn tuple_variant<V>(
- /// self,
- /// _len: usize,
- /// _visitor: V,
- /// ) -> Result<V::Value, Self::Error>
+ /// fn tuple_variant<V>(self, _len: usize, _visitor: V) -> Result<V::Value, Self::Error>
/// where
/// V: Visitor<'de>,
/// {
@@ -2178,7 +2174,7 @@ pub trait VariantAccess<'de>: Sized {
/// If the data contains a different type of variant, the following
/// `invalid_type` error should be constructed:
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::de::{self, value, DeserializeSeed, Visitor, VariantAccess, Unexpected};
/// #
/// # struct X;
@@ -2238,10 +2234,10 @@ pub trait VariantAccess<'de>: Sized {
///
/// # Example
///
-/// ```edition2018
+/// ```edition2021
+/// use serde::de::{value, Deserialize, IntoDeserializer};
+/// use serde_derive::Deserialize;
/// use std::str::FromStr;
-/// use serde::Deserialize;
-/// use serde::de::{value, IntoDeserializer};
///
/// #[derive(Deserialize)]
/// enum Setting {
diff --git a/vendor/serde/src/de/utf8.rs b/vendor/serde/src/de/utf8.rs
index 576fd03cf..96731cd63 100644
--- a/vendor/serde/src/de/utf8.rs
+++ b/vendor/serde/src/de/utf8.rs
@@ -31,7 +31,7 @@ pub fn encode(c: char) -> Encode {
buf[3] = (code & 0x3F) as u8 | TAG_CONT;
0
};
- Encode { buf: buf, pos: pos }
+ Encode { buf, pos }
}
pub struct Encode {
diff --git a/vendor/serde/src/de/value.rs b/vendor/serde/src/de/value.rs
index 5d8886215..392f8a239 100644
--- a/vendor/serde/src/de/value.rs
+++ b/vendor/serde/src/de/value.rs
@@ -1,10 +1,10 @@
//! Building blocks for deserializing basic values using the `IntoDeserializer`
//! trait.
//!
-//! ```edition2018
+//! ```edition2021
+//! use serde::de::{value, Deserialize, IntoDeserializer};
+//! use serde_derive::Deserialize;
//! use std::str::FromStr;
-//! use serde::Deserialize;
-//! use serde::de::{value, IntoDeserializer};
//!
//! #[derive(Deserialize)]
//! enum Setting {
@@ -251,7 +251,7 @@ macro_rules! primitive_deserializer {
#[allow(missing_docs)]
pub fn new(value: $ty) -> Self {
$name {
- value: value,
+ value,
marker: PhantomData,
}
}
@@ -330,7 +330,7 @@ impl<E> U32Deserializer<E> {
#[allow(missing_docs)]
pub fn new(value: u32) -> Self {
U32Deserializer {
- value: value,
+ value,
marker: PhantomData,
}
}
@@ -419,7 +419,7 @@ impl<'a, E> StrDeserializer<'a, E> {
#[allow(missing_docs)]
pub fn new(value: &'a str) -> Self {
StrDeserializer {
- value: value,
+ value,
marker: PhantomData,
}
}
@@ -498,7 +498,7 @@ impl<'de, E> BorrowedStrDeserializer<'de, E> {
/// Create a new borrowed deserializer from the given string.
pub fn new(value: &'de str) -> BorrowedStrDeserializer<'de, E> {
BorrowedStrDeserializer {
- value: value,
+ value,
marker: PhantomData,
}
}
@@ -598,7 +598,7 @@ impl<E> StringDeserializer<E> {
#[allow(missing_docs)]
pub fn new(value: String) -> Self {
StringDeserializer {
- value: value,
+ value,
marker: PhantomData,
}
}
@@ -701,7 +701,7 @@ impl<'a, E> CowStrDeserializer<'a, E> {
#[allow(missing_docs)]
pub fn new(value: Cow<'a, str>) -> Self {
CowStrDeserializer {
- value: value,
+ value,
marker: PhantomData,
}
}
@@ -783,7 +783,7 @@ impl<'a, E> BytesDeserializer<'a, E> {
/// Create a new deserializer from the given bytes.
pub fn new(value: &'a [u8]) -> Self {
BytesDeserializer {
- value: value,
+ value,
marker: PhantomData,
}
}
@@ -842,7 +842,7 @@ impl<'de, E> BorrowedBytesDeserializer<'de, E> {
/// Create a new borrowed deserializer from the given borrowed bytes.
pub fn new(value: &'de [u8]) -> Self {
BorrowedBytesDeserializer {
- value: value,
+ value,
marker: PhantomData,
}
}
@@ -1053,7 +1053,7 @@ pub struct SeqAccessDeserializer<A> {
impl<A> SeqAccessDeserializer<A> {
/// Construct a new `SeqAccessDeserializer<A>`.
pub fn new(seq: A) -> Self {
- SeqAccessDeserializer { seq: seq }
+ SeqAccessDeserializer { seq }
}
}
@@ -1454,7 +1454,7 @@ pub struct MapAccessDeserializer<A> {
impl<A> MapAccessDeserializer<A> {
/// Construct a new `MapAccessDeserializer<A>`.
pub fn new(map: A) -> Self {
- MapAccessDeserializer { map: map }
+ MapAccessDeserializer { map }
}
}
@@ -1519,7 +1519,7 @@ pub struct EnumAccessDeserializer<A> {
impl<A> EnumAccessDeserializer<A> {
/// Construct a new `EnumAccessDeserializer<A>`.
pub fn new(access: A) -> Self {
- EnumAccessDeserializer { access: access }
+ EnumAccessDeserializer { access }
}
}
@@ -1613,7 +1613,7 @@ mod private {
}
pub fn map_as_enum<A>(map: A) -> MapAsEnum<A> {
- MapAsEnum { map: map }
+ MapAsEnum { map }
}
impl<'de, A> VariantAccess<'de> for MapAsEnum<A>
@@ -1637,10 +1637,7 @@ mod private {
where
V: Visitor<'de>,
{
- self.map.next_value_seed(SeedTupleVariant {
- len: len,
- visitor: visitor,
- })
+ self.map.next_value_seed(SeedTupleVariant { len, visitor })
}
fn struct_variant<V>(
@@ -1651,8 +1648,7 @@ mod private {
where
V: Visitor<'de>,
{
- self.map
- .next_value_seed(SeedStructVariant { visitor: visitor })
+ self.map.next_value_seed(SeedStructVariant { visitor })
}
}
diff --git a/vendor/serde/src/integer128.rs b/vendor/serde/src/integer128.rs
index 904c2a233..a51291be6 100644
--- a/vendor/serde/src/integer128.rs
+++ b/vendor/serde/src/integer128.rs
@@ -9,7 +9,7 @@
/// or do not target platforms that lack 128-bit integers, do not need to
/// bother with this macro and may assume support for 128-bit integers.
///
-/// ```edition2018
+/// ```edition2021
/// # use serde::__private::doc::Error;
/// #
/// # struct MySerializer;
@@ -50,7 +50,7 @@
/// When Serde is built with support for 128-bit integers, this macro expands
/// transparently into just the input tokens.
///
-/// ```edition2018
+/// ```edition2021
/// macro_rules! serde_if_integer128 {
/// ($($tt:tt)*) => {
/// $($tt)*
@@ -61,7 +61,7 @@
/// When built without support for 128-bit integers, this macro expands to
/// nothing.
///
-/// ```edition2018
+/// ```edition2021
/// macro_rules! serde_if_integer128 {
/// ($($tt:tt)*) => {};
/// }
diff --git a/vendor/serde/src/lib.rs b/vendor/serde/src/lib.rs
index d788d6189..992633b8c 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.164")]
+#![doc(html_root_url = "https://docs.rs/serde/1.0.171")]
// 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
@@ -180,7 +180,7 @@ mod lib {
pub use self::core::fmt::{self, Debug, Display};
pub use self::core::marker::{self, PhantomData};
pub use self::core::num::Wrapping;
- pub use self::core::ops::Range;
+ pub use self::core::ops::{Range, RangeFrom, RangeTo};
pub use self::core::option::{self, Option};
pub use self::core::result::{self, Result};
diff --git a/vendor/serde/src/macros.rs b/vendor/serde/src/macros.rs
index 6502a23a7..71ddc1503 100644
--- a/vendor/serde/src/macros.rs
+++ b/vendor/serde/src/macros.rs
@@ -11,7 +11,7 @@
/// input. This requires repetitive implementations of all the [`Deserializer`]
/// trait methods.
///
-/// ```edition2018
+/// ```edition2021
/// # use serde::forward_to_deserialize_any;
/// # use serde::de::{value, Deserializer, Visitor};
/// #
@@ -47,7 +47,7 @@
/// methods so that they forward directly to [`Deserializer::deserialize_any`].
/// You can choose which methods to forward.
///
-/// ```edition2018
+/// ```edition2021
/// # use serde::forward_to_deserialize_any;
/// # use serde::de::{value, Deserializer, Visitor};
/// #
@@ -78,11 +78,10 @@
/// called `V`. A different type parameter and a different lifetime can be
/// specified explicitly if necessary.
///
-/// ```edition2018
-/// # use std::marker::PhantomData;
-/// #
+/// ```edition2021
/// # use serde::forward_to_deserialize_any;
/// # use serde::de::{value, Deserializer, Visitor};
+/// # use std::marker::PhantomData;
/// #
/// # struct MyDeserializer<V>(PhantomData<V>);
/// #
diff --git a/vendor/serde/src/private/de.rs b/vendor/serde/src/private/de.rs
index f0a0ee683..3c0a187ac 100644
--- a/vendor/serde/src/private/de.rs
+++ b/vendor/serde/src/private/de.rs
@@ -474,7 +474,8 @@ mod content {
where
V: SeqAccess<'de>,
{
- let mut vec = Vec::with_capacity(size_hint::cautious(visitor.size_hint()));
+ let mut vec =
+ Vec::<Content>::with_capacity(size_hint::cautious::<Content>(visitor.size_hint()));
while let Some(e) = try!(visitor.next_element()) {
vec.push(e);
}
@@ -485,7 +486,10 @@ mod content {
where
V: MapAccess<'de>,
{
- let mut vec = Vec::with_capacity(size_hint::cautious(visitor.size_hint()));
+ let mut vec =
+ Vec::<(Content, Content)>::with_capacity(
+ size_hint::cautious::<(Content, Content)>(visitor.size_hint()),
+ );
while let Some(kv) = try!(visitor.next_entry()) {
vec.push(kv);
}
@@ -518,7 +522,7 @@ mod content {
impl<'de> TagOrContentVisitor<'de> {
fn new(name: &'static str) -> Self {
TagOrContentVisitor {
- name: name,
+ name,
value: PhantomData,
}
}
@@ -797,51 +801,29 @@ mod content {
/// Used by generated code to deserialize an internally tagged enum.
///
/// Not public API.
- pub struct TaggedContent<'de, T> {
- pub tag: T,
- pub content: Content<'de>,
- }
-
- /// Not public API.
- pub struct TaggedContentVisitor<'de, T> {
+ pub struct TaggedContentVisitor<T> {
tag_name: &'static str,
expecting: &'static str,
- value: PhantomData<TaggedContent<'de, T>>,
+ value: PhantomData<T>,
}
- impl<'de, T> TaggedContentVisitor<'de, T> {
+ impl<T> TaggedContentVisitor<T> {
/// Visitor for the content of an internally tagged enum with the given
/// tag name.
pub fn new(name: &'static str, expecting: &'static str) -> Self {
TaggedContentVisitor {
tag_name: name,
- expecting: expecting,
+ expecting,
value: PhantomData,
}
}
}
- impl<'de, T> DeserializeSeed<'de> for TaggedContentVisitor<'de, T>
+ impl<'de, T> Visitor<'de> for TaggedContentVisitor<T>
where
T: Deserialize<'de>,
{
- type Value = TaggedContent<'de, T>;
-
- fn deserialize<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
- where
- D: Deserializer<'de>,
- {
- // Internally tagged enums are only supported in self-describing
- // formats.
- deserializer.deserialize_any(self)
- }
- }
-
- impl<'de, T> Visitor<'de> for TaggedContentVisitor<'de, T>
- where
- T: Deserialize<'de>,
- {
- type Value = TaggedContent<'de, T>;
+ type Value = (T, Content<'de>);
fn expecting(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.write_str(self.expecting)
@@ -858,10 +840,7 @@ mod content {
}
};
let rest = de::value::SeqAccessDeserializer::new(seq);
- Ok(TaggedContent {
- tag: tag,
- content: try!(Content::deserialize(rest)),
- })
+ Ok((tag, try!(Content::deserialize(rest))))
}
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
@@ -869,7 +848,10 @@ mod content {
M: MapAccess<'de>,
{
let mut tag = None;
- let mut vec = Vec::with_capacity(size_hint::cautious(map.size_hint()));
+ let mut vec = Vec::<(Content, Content)>::with_capacity(size_hint::cautious::<(
+ Content,
+ Content,
+ )>(map.size_hint()));
while let Some(k) = try!(map.next_key_seed(TagOrContentVisitor::new(self.tag_name))) {
match k {
TagOrContent::Tag => {
@@ -886,10 +868,7 @@ mod content {
}
match tag {
None => Err(de::Error::missing_field(self.tag_name)),
- Some(tag) => Ok(TaggedContent {
- tag: tag,
- content: Content::Map(vec),
- }),
+ Some(tag) => Ok((tag, Content::Map(vec))),
}
}
}
@@ -915,7 +894,7 @@ mod content {
where
D: Deserializer<'de>,
{
- deserializer.deserialize_str(self)
+ deserializer.deserialize_identifier(self)
}
}
@@ -926,6 +905,20 @@ mod content {
write!(formatter, "{:?} or {:?}", self.tag, self.content)
}
+ fn visit_u64<E>(self, field_index: u64) -> Result<Self::Value, E>
+ where
+ E: de::Error,
+ {
+ match field_index {
+ 0 => Ok(TagOrContentField::Tag),
+ 1 => Ok(TagOrContentField::Content),
+ _ => Err(de::Error::invalid_value(
+ Unexpected::Unsigned(field_index),
+ &self,
+ )),
+ }
+ }
+
fn visit_str<E>(self, field: &str) -> Result<Self::Value, E>
where
E: de::Error,
@@ -938,6 +931,19 @@ mod content {
Err(de::Error::invalid_value(Unexpected::Str(field), &self))
}
}
+
+ fn visit_bytes<E>(self, field: &[u8]) -> Result<Self::Value, E>
+ where
+ E: de::Error,
+ {
+ if field == self.tag.as_bytes() {
+ Ok(TagOrContentField::Tag)
+ } else if field == self.content.as_bytes() {
+ Ok(TagOrContentField::Content)
+ } else {
+ Err(de::Error::invalid_value(Unexpected::Bytes(field), &self))
+ }
+ }
}
/// Used by generated code to deserialize an adjacently tagged enum when
@@ -963,7 +969,7 @@ mod content {
where
D: Deserializer<'de>,
{
- deserializer.deserialize_str(self)
+ deserializer.deserialize_identifier(self)
}
}
@@ -978,6 +984,17 @@ mod content {
)
}
+ fn visit_u64<E>(self, field_index: u64) -> Result<Self::Value, E>
+ where
+ E: de::Error,
+ {
+ match field_index {
+ 0 => Ok(TagContentOtherField::Tag),
+ 1 => Ok(TagContentOtherField::Content),
+ _ => Ok(TagContentOtherField::Other),
+ }
+ }
+
fn visit_str<E>(self, field: &str) -> Result<Self::Value, E>
where
E: de::Error,
@@ -1464,7 +1481,7 @@ mod content {
/// private API, don't use
pub fn new(content: Content<'de>) -> Self {
ContentDeserializer {
- content: content,
+ content,
err: PhantomData,
}
}
@@ -1485,8 +1502,8 @@ mod content {
{
pub fn new(variant: Content<'de>, value: Option<Content<'de>>) -> EnumDeserializer<'de, E> {
EnumDeserializer {
- variant: variant,
- value: value,
+ variant,
+ value,
err: PhantomData,
}
}
@@ -2142,8 +2159,8 @@ mod content {
};
visitor.visit_enum(EnumRefDeserializer {
- variant: variant,
- value: value,
+ variant,
+ value,
err: PhantomData,
})
}
@@ -2187,7 +2204,7 @@ mod content {
/// private API, don't use
pub fn new(content: &'a Content<'de>) -> Self {
ContentRefDeserializer {
- content: content,
+ content,
err: PhantomData,
}
}
@@ -2496,8 +2513,8 @@ mod content {
/// Not public API.
pub fn new(type_name: &'a str, variant_name: &'a str) -> Self {
InternallyTaggedUnitVisitor {
- type_name: type_name,
- variant_name: variant_name,
+ type_name,
+ variant_name,
}
}
}
@@ -2541,8 +2558,8 @@ mod content {
/// Not public API.
pub fn new(type_name: &'a str, variant_name: &'a str) -> Self {
UntaggedUnitVisitor {
- type_name: type_name,
- variant_name: variant_name,
+ type_name,
+ variant_name,
}
}
}
@@ -2758,7 +2775,7 @@ where
where
V: Visitor<'de>,
{
- for entry in self.0.iter_mut() {
+ for entry in self.0 {
if let Some((key, value)) = flat_map_take_entry(entry, variants) {
return visitor.visit_enum(EnumDeserializer::new(key, Some(value)));
}
@@ -2793,7 +2810,7 @@ where
visitor.visit_map(FlatStructAccess {
iter: self.0.iter_mut(),
pending_content: None,
- fields: fields,
+ fields,
_marker: PhantomData,
})
}
@@ -2822,6 +2839,13 @@ where
visitor.visit_unit()
}
+ fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
+ where
+ V: Visitor<'de>,
+ {
+ visitor.visit_unit()
+ }
+
forward_to_deserialize_other! {
deserialize_bool()
deserialize_i8()
@@ -2844,7 +2868,6 @@ where
deserialize_tuple(usize)
deserialize_tuple_struct(&'static str, usize)
deserialize_identifier()
- deserialize_ignored_any()
}
}
diff --git a/vendor/serde/src/private/ser.rs b/vendor/serde/src/private/ser.rs
index 528e8c125..4dd45edae 100644
--- a/vendor/serde/src/private/ser.rs
+++ b/vendor/serde/src/private/ser.rs
@@ -27,10 +27,10 @@ where
T: Serialize,
{
value.serialize(TaggedSerializer {
- type_ident: type_ident,
- variant_ident: variant_ident,
- tag: tag,
- variant_name: variant_name,
+ type_ident,
+ variant_ident,
+ tag,
+ variant_name,
delegate: serializer,
})
}
@@ -350,8 +350,8 @@ mod content {
impl<M> SerializeTupleVariantAsMapValue<M> {
pub fn new(map: M, name: &'static str, len: usize) -> Self {
SerializeTupleVariantAsMapValue {
- map: map,
- name: name,
+ map,
+ name,
fields: Vec::with_capacity(len),
}
}
@@ -390,8 +390,8 @@ mod content {
impl<M> SerializeStructVariantAsMapValue<M> {
pub fn new(map: M, name: &'static str, len: usize) -> Self {
SerializeStructVariantAsMapValue {
- map: map,
- name: name,
+ map,
+ name,
fields: Vec::with_capacity(len),
}
}
@@ -711,7 +711,7 @@ mod content {
len: usize,
) -> Result<Self::SerializeTupleStruct, E> {
Ok(SerializeTupleStruct {
- name: name,
+ name,
fields: Vec::with_capacity(len),
error: PhantomData,
})
@@ -725,9 +725,9 @@ mod content {
len: usize,
) -> Result<Self::SerializeTupleVariant, E> {
Ok(SerializeTupleVariant {
- name: name,
- variant_index: variant_index,
- variant: variant,
+ name,
+ variant_index,
+ variant,
fields: Vec::with_capacity(len),
error: PhantomData,
})
@@ -747,7 +747,7 @@ mod content {
len: usize,
) -> Result<Self::SerializeStruct, E> {
Ok(SerializeStruct {
- name: name,
+ name,
fields: Vec::with_capacity(len),
error: PhantomData,
})
@@ -761,9 +761,9 @@ mod content {
len: usize,
) -> Result<Self::SerializeStructVariant, E> {
Ok(SerializeStructVariant {
- name: name,
- variant_index: variant_index,
- variant: variant,
+ name,
+ variant_index,
+ variant,
fields: Vec::with_capacity(len),
error: PhantomData,
})
@@ -1273,8 +1273,8 @@ where
{
fn new(map: &'a mut M, name: &'static str) -> FlatMapSerializeStructVariantAsMapValue<'a, M> {
FlatMapSerializeStructVariantAsMapValue {
- map: map,
- name: name,
+ map,
+ name,
fields: Vec::new(),
}
}
diff --git a/vendor/serde/src/private/size_hint.rs b/vendor/serde/src/private/size_hint.rs
index ca71e616b..571af496a 100644
--- a/vendor/serde/src/private/size_hint.rs
+++ b/vendor/serde/src/private/size_hint.rs
@@ -8,9 +8,17 @@ where
}
#[cfg(any(feature = "std", feature = "alloc"))]
-#[inline]
-pub fn cautious(hint: Option<usize>) -> usize {
- cmp::min(hint.unwrap_or(0), 4096)
+pub fn cautious<Element>(hint: Option<usize>) -> usize {
+ const MAX_PREALLOC_BYTES: usize = 1024 * 1024;
+
+ if mem::size_of::<Element>() == 0 {
+ 0
+ } else {
+ cmp::min(
+ hint.unwrap_or(0),
+ MAX_PREALLOC_BYTES / mem::size_of::<Element>(),
+ )
+ }
}
fn helper(bounds: (usize, Option<usize>)) -> Option<usize> {
diff --git a/vendor/serde/src/ser/fmt.rs b/vendor/serde/src/ser/fmt.rs
index e7e09a1bf..ce2d05ca8 100644
--- a/vendor/serde/src/ser/fmt.rs
+++ b/vendor/serde/src/ser/fmt.rs
@@ -17,8 +17,9 @@ macro_rules! fmt_primitives {
};
}
-/// ```edition2018
-/// use serde::Serialize;
+/// ```edition2021
+/// use serde::ser::Serialize;
+/// use serde_derive::Serialize;
/// use std::fmt::{self, Display};
///
/// #[derive(Serialize)]
diff --git a/vendor/serde/src/ser/impls.rs b/vendor/serde/src/ser/impls.rs
index a79326e5c..9cafb3264 100644
--- a/vendor/serde/src/ser/impls.rs
+++ b/vendor/serde/src/ser/impls.rs
@@ -257,6 +257,23 @@ where
////////////////////////////////////////////////////////////////////////////////
+impl<Idx> Serialize for RangeFrom<Idx>
+where
+ Idx: Serialize,
+{
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: Serializer,
+ {
+ use super::SerializeStruct;
+ let mut state = try!(serializer.serialize_struct("RangeFrom", 1));
+ try!(state.serialize_field("start", &self.start));
+ state.end()
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
#[cfg(not(no_range_inclusive))]
impl<Idx> Serialize for RangeInclusive<Idx>
where
@@ -276,6 +293,23 @@ where
////////////////////////////////////////////////////////////////////////////////
+impl<Idx> Serialize for RangeTo<Idx>
+where
+ Idx: Serialize,
+{
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
+ where
+ S: Serializer,
+ {
+ use super::SerializeStruct;
+ let mut state = try!(serializer.serialize_struct("RangeTo", 1));
+ try!(state.serialize_field("end", &self.end));
+ state.end()
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
#[cfg(any(not(no_ops_bound), all(feature = "std", not(no_collections_bound))))]
impl<T> Serialize for Bound<T>
where
@@ -713,7 +747,7 @@ impl Serialize for net::IpAddr {
}
#[cfg(feature = "std")]
-const DEC_DIGITS_LUT: &'static [u8] = b"\
+const DEC_DIGITS_LUT: &[u8] = b"\
0001020304050607080910111213141516171819\
2021222324252627282930313233343536373839\
4041424344454647484950515253545556575859\
diff --git a/vendor/serde/src/ser/impossible.rs b/vendor/serde/src/ser/impossible.rs
index e8df9ca7a..1d1d7ac84 100644
--- a/vendor/serde/src/ser/impossible.rs
+++ b/vendor/serde/src/ser/impossible.rs
@@ -15,7 +15,7 @@ use ser::{
/// [`SerializeTuple`], [`SerializeTupleStruct`], [`SerializeTupleVariant`],
/// [`SerializeMap`], [`SerializeStruct`], and [`SerializeStructVariant`].
///
-/// ```edition2018
+/// ```edition2021
/// # use serde::ser::{Serializer, Impossible};
/// # use serde::__private::doc::Error;
/// #
diff --git a/vendor/serde/src/ser/mod.rs b/vendor/serde/src/ser/mod.rs
index 5c45426e8..e1f38444d 100644
--- a/vendor/serde/src/ser/mod.rs
+++ b/vendor/serde/src/ser/mod.rs
@@ -149,7 +149,7 @@ macro_rules! declare_error_trait {
/// For example, a filesystem [`Path`] may refuse to serialize
/// itself if it contains invalid UTF-8 data.
///
- /// ```edition2018
+ /// ```edition2021
/// # struct Path;
/// #
/// # impl Path {
@@ -221,7 +221,7 @@ pub trait Serialize {
/// See the [Implementing `Serialize`] section of the manual for more
/// information about how to implement this method.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::ser::{Serialize, SerializeStruct, Serializer};
///
/// struct Person {
@@ -388,7 +388,7 @@ pub trait Serializer: Sized {
/// Serialize a `bool` value.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -410,7 +410,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `i64` and
/// forward to `serialize_i64`.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -432,7 +432,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `i64` and
/// forward to `serialize_i64`.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -454,7 +454,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `i64` and
/// forward to `serialize_i64`.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -472,7 +472,7 @@ pub trait Serializer: Sized {
/// Serialize an `i64` value.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -491,7 +491,7 @@ pub trait Serializer: Sized {
serde_if_integer128! {
/// Serialize an `i128` value.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -520,7 +520,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `u64` and
/// forward to `serialize_u64`.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -542,7 +542,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `u64` and
/// forward to `serialize_u64`.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -564,7 +564,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `u64` and
/// forward to `serialize_u64`.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -582,7 +582,7 @@ pub trait Serializer: Sized {
/// Serialize a `u64` value.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -601,7 +601,7 @@ pub trait Serializer: Sized {
serde_if_integer128! {
/// Serialize a `u128` value.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -630,7 +630,7 @@ pub trait Serializer: Sized {
/// reasonable implementation would be to cast the value to `f64` and
/// forward to `serialize_f64`.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -648,7 +648,7 @@ pub trait Serializer: Sized {
/// Serialize an `f64` value.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -669,7 +669,7 @@ pub trait Serializer: Sized {
/// If the format does not support characters, it is reasonable to serialize
/// it as a single element `str` or a `u32`.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -687,7 +687,7 @@ pub trait Serializer: Sized {
/// Serialize a `&str`.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -711,7 +711,7 @@ pub trait Serializer: Sized {
/// `serialize_seq`. If forwarded, the implementation looks usually just
/// like this:
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::ser::{Serializer, SerializeSeq};
/// # use serde::__private::doc::Error;
/// #
@@ -740,7 +740,7 @@ pub trait Serializer: Sized {
/// Serialize a [`None`] value.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::{Serialize, Serializer};
/// #
/// # enum Option<T> {
@@ -773,7 +773,7 @@ pub trait Serializer: Sized {
/// Serialize a [`Some(T)`] value.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::{Serialize, Serializer};
/// #
/// # enum Option<T> {
@@ -808,7 +808,7 @@ pub trait Serializer: Sized {
/// Serialize a `()` value.
///
- /// ```edition2018
+ /// ```edition2021
/// # use serde::Serializer;
/// #
/// # serde::__private_serialize!();
@@ -828,7 +828,7 @@ pub trait Serializer: Sized {
///
/// A reasonable implementation would be to forward to `serialize_unit`.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::{Serialize, Serializer};
///
/// struct Nothing;
@@ -850,7 +850,7 @@ pub trait Serializer: Sized {
/// this variant within the enum, and the `variant` is the name of the
/// variant.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::{Serialize, Serializer};
///
/// enum E {
@@ -883,7 +883,7 @@ pub trait Serializer: Sized {
/// wrappers around the data they contain. A reasonable implementation would
/// be to forward to `value.serialize(self)`.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::{Serialize, Serializer};
///
/// struct Millimeters(u8);
@@ -911,7 +911,7 @@ pub trait Serializer: Sized {
/// this variant within the enum, and the `variant` is the name of the
/// variant. The `value` is the data contained within this newtype variant.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::{Serialize, Serializer};
///
/// enum E {
@@ -949,7 +949,7 @@ pub trait Serializer: Sized {
/// not be computable before the sequence is iterated. Some serializers only
/// support sequences whose length is known up front.
///
- /// ```edition2018
+ /// ```edition2021
/// # use std::marker::PhantomData;
/// #
/// # struct Vec<T>(PhantomData<T>);
@@ -962,14 +962,14 @@ pub trait Serializer: Sized {
/// #
/// # impl<'a, T> IntoIterator for &'a Vec<T> {
/// # type Item = &'a T;
- /// # type IntoIter = Box<Iterator<Item = &'a T>>;
+ /// # type IntoIter = Box<dyn Iterator<Item = &'a T>>;
/// #
/// # fn into_iter(self) -> Self::IntoIter {
/// # unimplemented!()
/// # }
/// # }
/// #
- /// use serde::ser::{Serialize, Serializer, SerializeSeq};
+ /// use serde::ser::{Serialize, SerializeSeq, Serializer};
///
/// impl<T> Serialize for Vec<T>
/// where
@@ -994,8 +994,8 @@ pub trait Serializer: Sized {
/// This call must be followed by zero or more calls to `serialize_element`,
/// then a call to `end`.
///
- /// ```edition2018
- /// use serde::ser::{Serialize, Serializer, SerializeTuple};
+ /// ```edition2021
+ /// use serde::ser::{Serialize, SerializeTuple, Serializer};
///
/// # mod fool {
/// # trait Serialize {}
@@ -1024,7 +1024,7 @@ pub trait Serializer: Sized {
/// }
/// ```
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::ser::{Serialize, SerializeTuple, Serializer};
///
/// const VRAM_SIZE: usize = 386;
@@ -1052,7 +1052,7 @@ pub trait Serializer: Sized {
/// The `name` is the name of the tuple struct and the `len` is the number
/// of data fields that will be serialized.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::ser::{Serialize, SerializeTupleStruct, Serializer};
///
/// struct Rgb(u8, u8, u8);
@@ -1084,7 +1084,7 @@ pub trait Serializer: Sized {
/// this variant within the enum, the `variant` is the name of the variant,
/// and the `len` is the number of data fields that will be serialized.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::ser::{Serialize, SerializeTupleVariant, Serializer};
///
/// enum E {
@@ -1130,7 +1130,7 @@ pub trait Serializer: Sized {
/// be computable before the map is iterated. Some serializers only support
/// maps whose length is known up front.
///
- /// ```edition2018
+ /// ```edition2021
/// # use std::marker::PhantomData;
/// #
/// # struct HashMap<K, V>(PhantomData<K>, PhantomData<V>);
@@ -1143,14 +1143,14 @@ pub trait Serializer: Sized {
/// #
/// # impl<'a, K, V> IntoIterator for &'a HashMap<K, V> {
/// # type Item = (&'a K, &'a V);
- /// # type IntoIter = Box<Iterator<Item = (&'a K, &'a V)>>;
+ /// # type IntoIter = Box<dyn Iterator<Item = (&'a K, &'a V)>>;
/// #
/// # fn into_iter(self) -> Self::IntoIter {
/// # unimplemented!()
/// # }
/// # }
/// #
- /// use serde::ser::{Serialize, Serializer, SerializeMap};
+ /// use serde::ser::{Serialize, SerializeMap, Serializer};
///
/// impl<K, V> Serialize for HashMap<K, V>
/// where
@@ -1178,7 +1178,7 @@ pub trait Serializer: Sized {
/// The `name` is the name of the struct and the `len` is the number of
/// data fields that will be serialized.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::ser::{Serialize, SerializeStruct, Serializer};
///
/// struct Rgb {
@@ -1214,7 +1214,7 @@ pub trait Serializer: Sized {
/// this variant within the enum, the `variant` is the name of the variant,
/// and the `len` is the number of data fields that will be serialized.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::ser::{Serialize, SerializeStructVariant, Serializer};
///
/// enum E {
@@ -1256,7 +1256,7 @@ pub trait Serializer: Sized {
/// using [`serialize_seq`]. Implementors should not need to override this
/// method.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::{Serialize, Serializer};
///
/// struct SecretlyOneHigher {
@@ -1304,7 +1304,7 @@ pub trait Serializer: Sized {
/// using [`serialize_map`]. Implementors should not need to override this
/// method.
///
- /// ```edition2018
+ /// ```edition2021
/// use serde::{Serialize, Serializer};
/// use std::collections::BTreeSet;
///
@@ -1355,7 +1355,7 @@ pub trait Serializer: Sized {
/// delegates to [`serialize_str`]. Serializers are encouraged to provide a
/// more efficient implementation if possible.
///
- /// ```edition2018
+ /// ```edition2021
/// # struct DateTime;
/// #
/// # impl DateTime {
@@ -1370,9 +1370,7 @@ pub trait Serializer: Sized {
/// where
/// S: Serializer,
/// {
- /// serializer.collect_str(&format_args!("{:?}{:?}",
- /// self.naive_local(),
- /// self.offset()))
+ /// serializer.collect_str(&format_args!("{:?}{:?}", self.naive_local(), self.offset()))
/// }
/// }
/// ```
@@ -1393,7 +1391,7 @@ pub trait Serializer: Sized {
/// of this method. If no more sensible behavior is possible, the
/// implementation is expected to return an error.
///
- /// ```edition2018
+ /// ```edition2021
/// # struct DateTime;
/// #
/// # impl DateTime {
@@ -1408,9 +1406,7 @@ pub trait Serializer: Sized {
/// where
/// S: Serializer,
/// {
- /// serializer.collect_str(&format_args!("{:?}{:?}",
- /// self.naive_local(),
- /// self.offset()))
+ /// serializer.collect_str(&format_args!("{:?}{:?}", self.naive_local(), self.offset()))
/// }
/// }
/// ```
@@ -1428,7 +1424,7 @@ pub trait Serializer: Sized {
/// human-readable one and binary formats like Postcard will prefer the
/// compact one.
///
- /// ```edition2018
+ /// ```edition2021
/// # use std::fmt::{self, Display};
/// #
/// # struct Timestamp;
@@ -1477,7 +1473,7 @@ pub trait Serializer: Sized {
///
/// # Example use
///
-/// ```edition2018
+/// ```edition2021
/// # use std::marker::PhantomData;
/// #
/// # struct Vec<T>(PhantomData<T>);
@@ -1490,13 +1486,13 @@ pub trait Serializer: Sized {
/// #
/// # impl<'a, T> IntoIterator for &'a Vec<T> {
/// # type Item = &'a T;
-/// # type IntoIter = Box<Iterator<Item = &'a T>>;
+/// # type IntoIter = Box<dyn Iterator<Item = &'a T>>;
/// # fn into_iter(self) -> Self::IntoIter {
/// # unimplemented!()
/// # }
/// # }
/// #
-/// use serde::ser::{Serialize, Serializer, SerializeSeq};
+/// use serde::ser::{Serialize, SerializeSeq, Serializer};
///
/// impl<T> Serialize for Vec<T>
/// where
@@ -1541,8 +1537,8 @@ pub trait SerializeSeq {
///
/// # Example use
///
-/// ```edition2018
-/// use serde::ser::{Serialize, Serializer, SerializeTuple};
+/// ```edition2021
+/// use serde::ser::{Serialize, SerializeTuple, Serializer};
///
/// # mod fool {
/// # trait Serialize {}
@@ -1571,7 +1567,7 @@ pub trait SerializeSeq {
/// }
/// ```
///
-/// ```edition2018
+/// ```edition2021
/// # use std::marker::PhantomData;
/// #
/// # struct Array<T>(PhantomData<T>);
@@ -1584,13 +1580,13 @@ pub trait SerializeSeq {
/// #
/// # impl<'a, T> IntoIterator for &'a Array<T> {
/// # type Item = &'a T;
-/// # type IntoIter = Box<Iterator<Item = &'a T>>;
+/// # type IntoIter = Box<dyn Iterator<Item = &'a T>>;
/// # fn into_iter(self) -> Self::IntoIter {
/// # unimplemented!()
/// # }
/// # }
/// #
-/// use serde::ser::{Serialize, Serializer, SerializeTuple};
+/// use serde::ser::{Serialize, SerializeTuple, Serializer};
///
/// # mod fool {
/// # trait Serialize {}
@@ -1641,7 +1637,7 @@ pub trait SerializeTuple {
///
/// # Example use
///
-/// ```edition2018
+/// ```edition2021
/// use serde::ser::{Serialize, SerializeTupleStruct, Serializer};
///
/// struct Rgb(u8, u8, u8);
@@ -1686,7 +1682,7 @@ pub trait SerializeTupleStruct {
///
/// # Example use
///
-/// ```edition2018
+/// ```edition2021
/// use serde::ser::{Serialize, SerializeTupleVariant, Serializer};
///
/// enum E {
@@ -1744,7 +1740,7 @@ pub trait SerializeTupleVariant {
///
/// # Example use
///
-/// ```edition2018
+/// ```edition2021
/// # use std::marker::PhantomData;
/// #
/// # struct HashMap<K, V>(PhantomData<K>, PhantomData<V>);
@@ -1757,14 +1753,14 @@ pub trait SerializeTupleVariant {
/// #
/// # impl<'a, K, V> IntoIterator for &'a HashMap<K, V> {
/// # type Item = (&'a K, &'a V);
-/// # type IntoIter = Box<Iterator<Item = (&'a K, &'a V)>>;
+/// # type IntoIter = Box<dyn Iterator<Item = (&'a K, &'a V)>>;
/// #
/// # fn into_iter(self) -> Self::IntoIter {
/// # unimplemented!()
/// # }
/// # }
/// #
-/// use serde::ser::{Serialize, Serializer, SerializeMap};
+/// use serde::ser::{Serialize, SerializeMap, Serializer};
///
/// impl<K, V> Serialize for HashMap<K, V>
/// where
@@ -1855,7 +1851,7 @@ pub trait SerializeMap {
///
/// # Example use
///
-/// ```edition2018
+/// ```edition2021
/// use serde::ser::{Serialize, SerializeStruct, Serializer};
///
/// struct Rgb {
@@ -1915,7 +1911,7 @@ pub trait SerializeStruct {
///
/// # Example use
///
-/// ```edition2018
+/// ```edition2021
/// use serde::ser::{Serialize, SerializeStructVariant, Serializer};
///
/// enum E {
diff --git a/vendor/serde/src/std_error.rs b/vendor/serde/src/std_error.rs
index 1055e0ffb..fca023d16 100644
--- a/vendor/serde/src/std_error.rs
+++ b/vendor/serde/src/std_error.rs
@@ -9,7 +9,7 @@ use lib::{Debug, Display};
/// generally provide their error types with a `std::error::Error` impl
/// directly:
///
-/// ```edition2018
+/// ```edition2021
/// #[derive(Debug)]
/// struct MySerError {...}
///
@@ -29,7 +29,7 @@ use lib::{Debug, Display};
/// std = ["serde/std"]
/// ```
///
-/// ```edition2018
+/// ```edition2021
/// #[cfg(feature = "std")]
/// impl std::error::Error for MySerError {}
/// ```
@@ -37,7 +37,7 @@ use lib::{Debug, Display};
/// ... or else provide the std Error impl unconditionally via Serde's
/// re-export:
///
-/// ```edition2018
+/// ```edition2021
/// impl serde::ser::StdError for MySerError {}
/// ```
pub trait Error: Debug + Display {