/rust/registry/src/index.crates.io-6f17d22bba15001f/serde-1.0.219/src/de/impls.rs
Line | Count | Source (jump to first uncovered line) |
1 | | use crate::lib::*; |
2 | | |
3 | | use crate::de::{ |
4 | | Deserialize, Deserializer, EnumAccess, Error, MapAccess, SeqAccess, Unexpected, VariantAccess, |
5 | | Visitor, |
6 | | }; |
7 | | |
8 | | use crate::seed::InPlaceSeed; |
9 | | |
10 | | #[cfg(any(feature = "std", feature = "alloc"))] |
11 | | use crate::de::size_hint; |
12 | | |
13 | | //////////////////////////////////////////////////////////////////////////////// |
14 | | |
15 | | struct UnitVisitor; |
16 | | |
17 | | impl<'de> Visitor<'de> for UnitVisitor { |
18 | | type Value = (); |
19 | | |
20 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
21 | 0 | formatter.write_str("unit") |
22 | 0 | } |
23 | | |
24 | 3.40M | fn visit_unit<E>(self) -> Result<Self::Value, E> |
25 | 3.40M | where |
26 | 3.40M | E: Error, |
27 | 3.40M | { |
28 | 3.40M | Ok(()) |
29 | 3.40M | } Unexecuted instantiation: <serde::de::impls::UnitVisitor as serde::de::Visitor>::visit_unit::<_> <serde::de::impls::UnitVisitor as serde::de::Visitor>::visit_unit::<ron::error::Error> Line | Count | Source | 24 | 3.40M | fn visit_unit<E>(self) -> Result<Self::Value, E> | 25 | 3.40M | where | 26 | 3.40M | E: Error, | 27 | 3.40M | { | 28 | 3.40M | Ok(()) | 29 | 3.40M | } |
|
30 | | } |
31 | | |
32 | | impl<'de> Deserialize<'de> for () { |
33 | 3.40M | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
34 | 3.40M | where |
35 | 3.40M | D: Deserializer<'de>, |
36 | 3.40M | { |
37 | 3.40M | deserializer.deserialize_unit(UnitVisitor) |
38 | 3.40M | } Unexecuted instantiation: <() as serde::de::Deserialize>::deserialize::<_> <() as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 33 | 3.00k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 34 | 3.00k | where | 35 | 3.00k | D: Deserializer<'de>, | 36 | 3.00k | { | 37 | 3.00k | deserializer.deserialize_unit(UnitVisitor) | 38 | 3.00k | } |
Unexecuted instantiation: <() as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <() as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 33 | 718k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 34 | 718k | where | 35 | 718k | D: Deserializer<'de>, | 36 | 718k | { | 37 | 718k | deserializer.deserialize_unit(UnitVisitor) | 38 | 718k | } |
Unexecuted instantiation: <() as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> <() as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> Line | Count | Source | 33 | 828k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 34 | 828k | where | 35 | 828k | D: Deserializer<'de>, | 36 | 828k | { | 37 | 828k | deserializer.deserialize_unit(UnitVisitor) | 38 | 828k | } |
<() as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 33 | 502k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 34 | 502k | where | 35 | 502k | D: Deserializer<'de>, | 36 | 502k | { | 37 | 502k | deserializer.deserialize_unit(UnitVisitor) | 38 | 502k | } |
<() as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 33 | 1.28M | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 34 | 1.28M | where | 35 | 1.28M | D: Deserializer<'de>, | 36 | 1.28M | { | 37 | 1.28M | deserializer.deserialize_unit(UnitVisitor) | 38 | 1.28M | } |
<() as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 33 | 75.0k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 34 | 75.0k | where | 35 | 75.0k | D: Deserializer<'de>, | 36 | 75.0k | { | 37 | 75.0k | deserializer.deserialize_unit(UnitVisitor) | 38 | 75.0k | } |
Unexecuted instantiation: <() as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <() as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> |
39 | | } |
40 | | |
41 | | #[cfg(feature = "unstable")] |
42 | | #[cfg_attr(docsrs, doc(cfg(feature = "unstable")))] |
43 | | impl<'de> Deserialize<'de> for ! { |
44 | | fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error> |
45 | | where |
46 | | D: Deserializer<'de>, |
47 | | { |
48 | | Err(Error::custom("cannot deserialize `!`")) |
49 | | } |
50 | | } |
51 | | |
52 | | //////////////////////////////////////////////////////////////////////////////// |
53 | | |
54 | | struct BoolVisitor; |
55 | | |
56 | | impl<'de> Visitor<'de> for BoolVisitor { |
57 | | type Value = bool; |
58 | | |
59 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
60 | 0 | formatter.write_str("a boolean") |
61 | 0 | } |
62 | | |
63 | 1.78M | fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E> |
64 | 1.78M | where |
65 | 1.78M | E: Error, |
66 | 1.78M | { |
67 | 1.78M | Ok(v) |
68 | 1.78M | } Unexecuted instantiation: <serde::de::impls::BoolVisitor as serde::de::Visitor>::visit_bool::<_> <serde::de::impls::BoolVisitor as serde::de::Visitor>::visit_bool::<ron::error::Error> Line | Count | Source | 63 | 1.78M | fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E> | 64 | 1.78M | where | 65 | 1.78M | E: Error, | 66 | 1.78M | { | 67 | 1.78M | Ok(v) | 68 | 1.78M | } |
|
69 | | } |
70 | | |
71 | | impl<'de> Deserialize<'de> for bool { |
72 | 1.78M | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
73 | 1.78M | where |
74 | 1.78M | D: Deserializer<'de>, |
75 | 1.78M | { |
76 | 1.78M | deserializer.deserialize_bool(BoolVisitor) |
77 | 1.78M | } Unexecuted instantiation: <bool as serde::de::Deserialize>::deserialize::<_> <bool as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 72 | 501 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 73 | 501 | where | 74 | 501 | D: Deserializer<'de>, | 75 | 501 | { | 76 | 501 | deserializer.deserialize_bool(BoolVisitor) | 77 | 501 | } |
Unexecuted instantiation: <bool as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <bool as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 72 | 175k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 73 | 175k | where | 74 | 175k | D: Deserializer<'de>, | 75 | 175k | { | 76 | 175k | deserializer.deserialize_bool(BoolVisitor) | 77 | 175k | } |
Unexecuted instantiation: <bool as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <bool as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <bool as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 72 | 89.1k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 73 | 89.1k | where | 74 | 89.1k | D: Deserializer<'de>, | 75 | 89.1k | { | 76 | 89.1k | deserializer.deserialize_bool(BoolVisitor) | 77 | 89.1k | } |
<bool as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 72 | 1.51M | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 73 | 1.51M | where | 74 | 1.51M | D: Deserializer<'de>, | 75 | 1.51M | { | 76 | 1.51M | deserializer.deserialize_bool(BoolVisitor) | 77 | 1.51M | } |
<bool as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 72 | 1.65k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 73 | 1.65k | where | 74 | 1.65k | D: Deserializer<'de>, | 75 | 1.65k | { | 76 | 1.65k | deserializer.deserialize_bool(BoolVisitor) | 77 | 1.65k | } |
Unexecuted instantiation: <bool as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <bool as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> |
78 | | } |
79 | | |
80 | | //////////////////////////////////////////////////////////////////////////////// |
81 | | |
82 | | macro_rules! impl_deserialize_num { |
83 | | ($primitive:ident, $nonzero:ident $(cfg($($cfg:tt)*))*, $deserialize:ident $($method:ident!($($val:ident : $visit:ident)*);)*) => { |
84 | | impl_deserialize_num!($primitive, $deserialize $($method!($($val : $visit)*);)*); |
85 | | |
86 | | $(#[cfg($($cfg)*)])* |
87 | | impl<'de> Deserialize<'de> for num::$nonzero { |
88 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
89 | 0 | where |
90 | 0 | D: Deserializer<'de>, |
91 | 0 | { |
92 | | struct NonZeroVisitor; |
93 | | |
94 | | impl<'de> Visitor<'de> for NonZeroVisitor { |
95 | | type Value = num::$nonzero; |
96 | | |
97 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
98 | 0 | formatter.write_str(concat!("a nonzero ", stringify!($primitive))) |
99 | 0 | } Unexecuted instantiation: <<core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::expecting |
100 | | |
101 | | $($($method!(nonzero $primitive $val : $visit);)*)* |
102 | | } |
103 | | |
104 | 0 | deserializer.$deserialize(NonZeroVisitor) |
105 | 0 | } Unexecuted instantiation: <core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::<_> |
106 | | } |
107 | | |
108 | | #[cfg(not(no_core_num_saturating))] |
109 | | impl<'de> Deserialize<'de> for Saturating<$primitive> { |
110 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
111 | 0 | where |
112 | 0 | D: Deserializer<'de>, |
113 | 0 | { |
114 | | struct SaturatingVisitor; |
115 | | |
116 | | impl<'de> Visitor<'de> for SaturatingVisitor { |
117 | | type Value = Saturating<$primitive>; |
118 | | |
119 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
120 | 0 | formatter.write_str("integer with support for saturating semantics") |
121 | 0 | } Unexecuted instantiation: <<core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::expecting |
122 | | |
123 | | $($($method!(saturating $primitive $val : $visit);)*)* |
124 | | } |
125 | | |
126 | 0 | deserializer.$deserialize(SaturatingVisitor) |
127 | 0 | } Unexecuted instantiation: <core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::<_> |
128 | | } |
129 | | }; |
130 | | |
131 | | ($primitive:ident, $deserialize:ident $($method:ident!($($val:ident : $visit:ident)*);)*) => { |
132 | | impl<'de> Deserialize<'de> for $primitive { |
133 | | #[inline] |
134 | 9.28M | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
135 | 9.28M | where |
136 | 9.28M | D: Deserializer<'de>, |
137 | 9.28M | { |
138 | | struct PrimitiveVisitor; |
139 | | |
140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { |
141 | | type Value = $primitive; |
142 | | |
143 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
144 | 0 | formatter.write_str(stringify!($primitive)) |
145 | 0 | } Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::expecting |
146 | | |
147 | | $($($method!($val : $visit);)*)* |
148 | | } |
149 | | |
150 | 9.28M | deserializer.$deserialize(PrimitiveVisitor) |
151 | 9.28M | } <u8 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 769k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 769k | where | 136 | 769k | D: Deserializer<'de>, | 137 | 769k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 769k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 769k | } |
Unexecuted instantiation: <i8 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <i16 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <i32 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <i64 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <isize as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <u8 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <u16 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <u32 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <u64 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <usize as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <f32 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <f64 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <i128 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <u128 as serde::de::Deserialize>::deserialize::<_> <u16 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 10.4k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 10.4k | where | 136 | 10.4k | D: Deserializer<'de>, | 137 | 10.4k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 10.4k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 10.4k | } |
Unexecuted instantiation: <u16 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <u16 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 160k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 160k | where | 136 | 160k | D: Deserializer<'de>, | 137 | 160k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 160k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 160k | } |
Unexecuted instantiation: <u16 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <u16 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <u16 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 17.6k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 17.6k | where | 136 | 17.6k | D: Deserializer<'de>, | 137 | 17.6k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 17.6k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 17.6k | } |
<u16 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 117k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 117k | where | 136 | 117k | D: Deserializer<'de>, | 137 | 117k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 117k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 117k | } |
<u16 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 2.27k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 2.27k | where | 136 | 2.27k | D: Deserializer<'de>, | 137 | 2.27k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 2.27k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 2.27k | } |
Unexecuted instantiation: <u16 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <u16 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <u32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 3.11k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 3.11k | where | 136 | 3.11k | D: Deserializer<'de>, | 137 | 3.11k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 3.11k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 3.11k | } |
Unexecuted instantiation: <u32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <u32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 18.4k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 18.4k | where | 136 | 18.4k | D: Deserializer<'de>, | 137 | 18.4k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 18.4k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 18.4k | } |
Unexecuted instantiation: <u32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <u32 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <u32 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 79.6k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 79.6k | where | 136 | 79.6k | D: Deserializer<'de>, | 137 | 79.6k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 79.6k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 79.6k | } |
<u32 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 23.9k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 23.9k | where | 136 | 23.9k | D: Deserializer<'de>, | 137 | 23.9k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 23.9k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 23.9k | } |
<u32 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 810 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 810 | where | 136 | 810 | D: Deserializer<'de>, | 137 | 810 | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 810 | deserializer.$deserialize(PrimitiveVisitor) | 151 | 810 | } |
Unexecuted instantiation: <u32 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <u32 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <u64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 1.52k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 1.52k | where | 136 | 1.52k | D: Deserializer<'de>, | 137 | 1.52k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 1.52k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 1.52k | } |
Unexecuted instantiation: <u64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <u64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 6.16k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 6.16k | where | 136 | 6.16k | D: Deserializer<'de>, | 137 | 6.16k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 6.16k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 6.16k | } |
Unexecuted instantiation: <u64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <u64 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <u64 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 37.9k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 37.9k | where | 136 | 37.9k | D: Deserializer<'de>, | 137 | 37.9k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 37.9k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 37.9k | } |
<u64 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 8.29k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 8.29k | where | 136 | 8.29k | D: Deserializer<'de>, | 137 | 8.29k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 8.29k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 8.29k | } |
<u64 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 456 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 456 | where | 136 | 456 | D: Deserializer<'de>, | 137 | 456 | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 456 | deserializer.$deserialize(PrimitiveVisitor) | 151 | 456 | } |
Unexecuted instantiation: <u64 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <u64 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <usize as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 1.53k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 1.53k | where | 136 | 1.53k | D: Deserializer<'de>, | 137 | 1.53k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 1.53k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 1.53k | } |
Unexecuted instantiation: <usize as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <usize as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 57.0k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 57.0k | where | 136 | 57.0k | D: Deserializer<'de>, | 137 | 57.0k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 57.0k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 57.0k | } |
Unexecuted instantiation: <usize as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <usize as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <usize as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 14.3k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 14.3k | where | 136 | 14.3k | D: Deserializer<'de>, | 137 | 14.3k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 14.3k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 14.3k | } |
<usize as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 13.7k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 13.7k | where | 136 | 13.7k | D: Deserializer<'de>, | 137 | 13.7k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 13.7k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 13.7k | } |
<usize as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 11.8k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 11.8k | where | 136 | 11.8k | D: Deserializer<'de>, | 137 | 11.8k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 11.8k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 11.8k | } |
Unexecuted instantiation: <usize as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <usize as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <f32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 735 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 735 | where | 136 | 735 | D: Deserializer<'de>, | 137 | 735 | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 735 | deserializer.$deserialize(PrimitiveVisitor) | 151 | 735 | } |
Unexecuted instantiation: <f32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <f32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 23.5k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 23.5k | where | 136 | 23.5k | D: Deserializer<'de>, | 137 | 23.5k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 23.5k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 23.5k | } |
Unexecuted instantiation: <f32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <f32 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <f32 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 79.0k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 79.0k | where | 136 | 79.0k | D: Deserializer<'de>, | 137 | 79.0k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 79.0k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 79.0k | } |
<f32 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 83.1k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 83.1k | where | 136 | 83.1k | D: Deserializer<'de>, | 137 | 83.1k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 83.1k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 83.1k | } |
<f32 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 3.22k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 3.22k | where | 136 | 3.22k | D: Deserializer<'de>, | 137 | 3.22k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 3.22k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 3.22k | } |
Unexecuted instantiation: <f32 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <f32 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <f64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 3.87k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 3.87k | where | 136 | 3.87k | D: Deserializer<'de>, | 137 | 3.87k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 3.87k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 3.87k | } |
Unexecuted instantiation: <f64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <f64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 20.7k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 20.7k | where | 136 | 20.7k | D: Deserializer<'de>, | 137 | 20.7k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 20.7k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 20.7k | } |
Unexecuted instantiation: <f64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <f64 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <f64 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 52.8k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 52.8k | where | 136 | 52.8k | D: Deserializer<'de>, | 137 | 52.8k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 52.8k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 52.8k | } |
<f64 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 108k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 108k | where | 136 | 108k | D: Deserializer<'de>, | 137 | 108k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 108k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 108k | } |
<f64 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 22.8k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 22.8k | where | 136 | 22.8k | D: Deserializer<'de>, | 137 | 22.8k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 22.8k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 22.8k | } |
Unexecuted instantiation: <f64 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <f64 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <i128 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 3.40k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 3.40k | where | 136 | 3.40k | D: Deserializer<'de>, | 137 | 3.40k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 3.40k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 3.40k | } |
Unexecuted instantiation: <i128 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <i128 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 211k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 211k | where | 136 | 211k | D: Deserializer<'de>, | 137 | 211k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 211k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 211k | } |
Unexecuted instantiation: <i128 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <i128 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> Unexecuted instantiation: <i128 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Unexecuted instantiation: <i128 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> <i128 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 375 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 375 | where | 136 | 375 | D: Deserializer<'de>, | 137 | 375 | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 375 | deserializer.$deserialize(PrimitiveVisitor) | 151 | 375 | } |
Unexecuted instantiation: <i128 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <i128 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <u128 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 5.14k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 5.14k | where | 136 | 5.14k | D: Deserializer<'de>, | 137 | 5.14k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 5.14k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 5.14k | } |
Unexecuted instantiation: <u128 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <u128 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 57.7k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 57.7k | where | 136 | 57.7k | D: Deserializer<'de>, | 137 | 57.7k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 57.7k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 57.7k | } |
Unexecuted instantiation: <u128 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <u128 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> Unexecuted instantiation: <u128 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Unexecuted instantiation: <u128 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> <u128 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 2.73k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 2.73k | where | 136 | 2.73k | D: Deserializer<'de>, | 137 | 2.73k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 2.73k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 2.73k | } |
Unexecuted instantiation: <u128 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <u128 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <i8 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 1.54k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 1.54k | where | 136 | 1.54k | D: Deserializer<'de>, | 137 | 1.54k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 1.54k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 1.54k | } |
Unexecuted instantiation: <i8 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <i8 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 1.15M | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 1.15M | where | 136 | 1.15M | D: Deserializer<'de>, | 137 | 1.15M | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 1.15M | deserializer.$deserialize(PrimitiveVisitor) | 151 | 1.15M | } |
Unexecuted instantiation: <i8 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <i8 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <i8 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 69.0k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 69.0k | where | 136 | 69.0k | D: Deserializer<'de>, | 137 | 69.0k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 69.0k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 69.0k | } |
<i8 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 529k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 529k | where | 136 | 529k | D: Deserializer<'de>, | 137 | 529k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 529k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 529k | } |
<i8 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 1.25k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 1.25k | where | 136 | 1.25k | D: Deserializer<'de>, | 137 | 1.25k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 1.25k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 1.25k | } |
Unexecuted instantiation: <i8 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <i8 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <i16 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 1.40k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 1.40k | where | 136 | 1.40k | D: Deserializer<'de>, | 137 | 1.40k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 1.40k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 1.40k | } |
Unexecuted instantiation: <i16 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <i16 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 433k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 433k | where | 136 | 433k | D: Deserializer<'de>, | 137 | 433k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 433k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 433k | } |
Unexecuted instantiation: <i16 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <i16 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <i16 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 60.3k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 60.3k | where | 136 | 60.3k | D: Deserializer<'de>, | 137 | 60.3k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 60.3k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 60.3k | } |
<i16 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 7.05k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 7.05k | where | 136 | 7.05k | D: Deserializer<'de>, | 137 | 7.05k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 7.05k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 7.05k | } |
<i16 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 1.15k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 1.15k | where | 136 | 1.15k | D: Deserializer<'de>, | 137 | 1.15k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 1.15k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 1.15k | } |
Unexecuted instantiation: <i16 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <i16 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <i32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 2.05k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 2.05k | where | 136 | 2.05k | D: Deserializer<'de>, | 137 | 2.05k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 2.05k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 2.05k | } |
Unexecuted instantiation: <i32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <i32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 188k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 188k | where | 136 | 188k | D: Deserializer<'de>, | 137 | 188k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 188k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 188k | } |
Unexecuted instantiation: <i32 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <i32 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <i32 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 354k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 354k | where | 136 | 354k | D: Deserializer<'de>, | 137 | 354k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 354k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 354k | } |
<i32 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 223k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 223k | where | 136 | 223k | D: Deserializer<'de>, | 137 | 223k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 223k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 223k | } |
<i32 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 2.35k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 2.35k | where | 136 | 2.35k | D: Deserializer<'de>, | 137 | 2.35k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 2.35k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 2.35k | } |
Unexecuted instantiation: <i32 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <i32 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <i64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 2.33k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 2.33k | where | 136 | 2.33k | D: Deserializer<'de>, | 137 | 2.33k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 2.33k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 2.33k | } |
Unexecuted instantiation: <i64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <i64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 594k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 594k | where | 136 | 594k | D: Deserializer<'de>, | 137 | 594k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 594k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 594k | } |
Unexecuted instantiation: <i64 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <i64 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <i64 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 55.0k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 55.0k | where | 136 | 55.0k | D: Deserializer<'de>, | 137 | 55.0k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 55.0k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 55.0k | } |
<i64 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 62.0k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 62.0k | where | 136 | 62.0k | D: Deserializer<'de>, | 137 | 62.0k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 62.0k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 62.0k | } |
<i64 as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 59.7k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 59.7k | where | 136 | 59.7k | D: Deserializer<'de>, | 137 | 59.7k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 59.7k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 59.7k | } |
Unexecuted instantiation: <i64 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <i64 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <isize as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 1.76k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 1.76k | where | 136 | 1.76k | D: Deserializer<'de>, | 137 | 1.76k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 1.76k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 1.76k | } |
Unexecuted instantiation: <isize as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <isize as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 8.73k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 8.73k | where | 136 | 8.73k | D: Deserializer<'de>, | 137 | 8.73k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 8.73k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 8.73k | } |
Unexecuted instantiation: <isize as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <isize as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <isize as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 148k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 148k | where | 136 | 148k | D: Deserializer<'de>, | 137 | 148k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 148k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 148k | } |
<isize as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 381k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 381k | where | 136 | 381k | D: Deserializer<'de>, | 137 | 381k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 381k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 381k | } |
<isize as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 134 | 685 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 685 | where | 136 | 685 | D: Deserializer<'de>, | 137 | 685 | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 685 | deserializer.$deserialize(PrimitiveVisitor) | 151 | 685 | } |
Unexecuted instantiation: <isize as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <isize as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> <u8 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 1.72k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 1.72k | where | 136 | 1.72k | D: Deserializer<'de>, | 137 | 1.72k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 1.72k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 1.72k | } |
Unexecuted instantiation: <u8 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <u8 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 134 | 41.0k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 41.0k | where | 136 | 41.0k | D: Deserializer<'de>, | 137 | 41.0k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 41.0k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 41.0k | } |
Unexecuted instantiation: <u8 as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <u8 as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <u8 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 134 | 388k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 388k | where | 136 | 388k | D: Deserializer<'de>, | 137 | 388k | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 388k | deserializer.$deserialize(PrimitiveVisitor) | 151 | 388k | } |
<u8 as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 134 | 2.47M | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 135 | 2.47M | where | 136 | 2.47M | D: Deserializer<'de>, | 137 | 2.47M | { | 138 | | struct PrimitiveVisitor; | 139 | | | 140 | | impl<'de> Visitor<'de> for PrimitiveVisitor { | 141 | | type Value = $primitive; | 142 | | | 143 | | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { | 144 | | formatter.write_str(stringify!($primitive)) | 145 | | } | 146 | | | 147 | | $($($method!($val : $visit);)*)* | 148 | | } | 149 | | | 150 | 2.47M | deserializer.$deserialize(PrimitiveVisitor) | 151 | 2.47M | } |
Unexecuted instantiation: <u8 as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <u8 as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> |
152 | | } |
153 | | }; |
154 | | } |
155 | | |
156 | | macro_rules! num_self { |
157 | | ($ty:ident : $visit:ident) => { |
158 | | #[inline] |
159 | 8.00M | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
160 | 8.00M | where |
161 | 8.00M | E: Error, |
162 | 8.00M | { |
163 | 8.00M | Ok(v) |
164 | 8.00M | } <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 159 | 3.67M | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 3.67M | where | 161 | 3.67M | E: Error, | 162 | 3.67M | { | 163 | 3.67M | Ok(v) | 164 | 3.67M | } |
Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_f32::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_f64::<_> Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i128::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u128::<_> <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Line | Count | Source | 159 | 270k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 270k | where | 161 | 270k | E: Error, | 162 | 270k | { | 163 | 270k | Ok(v) | 164 | 270k | } |
<<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Line | Count | Source | 159 | 114k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 114k | where | 161 | 114k | E: Error, | 162 | 114k | { | 163 | 114k | Ok(v) | 164 | 114k | } |
<<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> Line | Count | Source | 159 | 41.1k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 41.1k | where | 161 | 41.1k | E: Error, | 162 | 41.1k | { | 163 | 41.1k | Ok(v) | 164 | 41.1k | } |
<<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_f32::<ron::error::Error> Line | Count | Source | 159 | 186k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 186k | where | 161 | 186k | E: Error, | 162 | 186k | { | 163 | 186k | Ok(v) | 164 | 186k | } |
<<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_f64::<ron::error::Error> Line | Count | Source | 159 | 77.9k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 77.9k | where | 161 | 77.9k | E: Error, | 162 | 77.9k | { | 163 | 77.9k | Ok(v) | 164 | 77.9k | } |
<<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i128::<ron::error::Error> Line | Count | Source | 159 | 215k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 215k | where | 161 | 215k | E: Error, | 162 | 215k | { | 163 | 215k | Ok(v) | 164 | 215k | } |
<<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u128::<ron::error::Error> Line | Count | Source | 159 | 65.6k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 65.6k | where | 161 | 65.6k | E: Error, | 162 | 65.6k | { | 163 | 65.6k | Ok(v) | 164 | 65.6k | } |
<<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Line | Count | Source | 159 | 1.74M | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 1.74M | where | 161 | 1.74M | E: Error, | 162 | 1.74M | { | 163 | 1.74M | Ok(v) | 164 | 1.74M | } |
<<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Line | Count | Source | 159 | 495k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 495k | where | 161 | 495k | E: Error, | 162 | 495k | { | 163 | 495k | Ok(v) | 164 | 495k | } |
<<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Line | Count | Source | 159 | 382k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 382k | where | 161 | 382k | E: Error, | 162 | 382k | { | 163 | 382k | Ok(v) | 164 | 382k | } |
<<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Line | Count | Source | 159 | 734k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 160 | 734k | where | 161 | 734k | E: Error, | 162 | 734k | { | 163 | 734k | Ok(v) | 164 | 734k | } |
|
165 | | }; |
166 | | |
167 | | (nonzero $primitive:ident $ty:ident : $visit:ident) => { |
168 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
169 | 0 | where |
170 | 0 | E: Error, |
171 | 0 | { |
172 | 0 | if let Some(nonzero) = Self::Value::new(v) { |
173 | 0 | Ok(nonzero) |
174 | | } else { |
175 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(0), &self)) |
176 | | } |
177 | 0 | } Unexecuted instantiation: <<core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i128::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u128::<_> |
178 | | }; |
179 | | |
180 | | (saturating $primitive:ident $ty:ident : $visit:ident) => { |
181 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
182 | 0 | where |
183 | 0 | E: Error, |
184 | 0 | { |
185 | 0 | Ok(Saturating(v)) |
186 | 0 | } Unexecuted instantiation: <<core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i128::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u128::<_> |
187 | | }; |
188 | | } |
189 | | |
190 | | macro_rules! num_as_self { |
191 | | ($ty:ident : $visit:ident) => { |
192 | | #[inline] |
193 | 75.2k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
194 | 75.2k | where |
195 | 75.2k | E: Error, |
196 | 75.2k | { |
197 | 75.2k | Ok(v as Self::Value) |
198 | 75.2k | } Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 193 | 38.0k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 38.0k | where | 195 | 38.0k | E: Error, | 196 | 38.0k | { | 197 | 38.0k | Ok(v as Self::Value) | 198 | 38.0k | } |
<<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 193 | 10.9k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 10.9k | where | 195 | 10.9k | E: Error, | 196 | 10.9k | { | 197 | 10.9k | Ok(v as Self::Value) | 198 | 10.9k | } |
<<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Line | Count | Source | 193 | 472 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 472 | where | 195 | 472 | E: Error, | 196 | 472 | { | 197 | 472 | Ok(v as Self::Value) | 198 | 472 | } |
<<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 193 | 12.3k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 12.3k | where | 195 | 12.3k | E: Error, | 196 | 12.3k | { | 197 | 12.3k | Ok(v as Self::Value) | 198 | 12.3k | } |
<<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Line | Count | Source | 193 | 501 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 501 | where | 195 | 501 | E: Error, | 196 | 501 | { | 197 | 501 | Ok(v as Self::Value) | 198 | 501 | } |
<<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Line | Count | Source | 193 | 431 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 431 | where | 195 | 431 | E: Error, | 196 | 431 | { | 197 | 431 | Ok(v as Self::Value) | 198 | 431 | } |
<<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 193 | 6.90k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 6.90k | where | 195 | 6.90k | E: Error, | 196 | 6.90k | { | 197 | 6.90k | Ok(v as Self::Value) | 198 | 6.90k | } |
<<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Line | Count | Source | 193 | 313 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 313 | where | 195 | 313 | E: Error, | 196 | 313 | { | 197 | 313 | Ok(v as Self::Value) | 198 | 313 | } |
Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Line | Count | Source | 193 | 661 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 661 | where | 195 | 661 | E: Error, | 196 | 661 | { | 197 | 661 | Ok(v as Self::Value) | 198 | 661 | } |
<<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Line | Count | Source | 193 | 1.02k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 1.02k | where | 195 | 1.02k | E: Error, | 196 | 1.02k | { | 197 | 1.02k | Ok(v as Self::Value) | 198 | 1.02k | } |
<<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Line | Count | Source | 193 | 596 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 596 | where | 195 | 596 | E: Error, | 196 | 596 | { | 197 | 596 | Ok(v as Self::Value) | 198 | 596 | } |
<<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Line | Count | Source | 193 | 529 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 529 | where | 195 | 529 | E: Error, | 196 | 529 | { | 197 | 529 | Ok(v as Self::Value) | 198 | 529 | } |
<<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Line | Count | Source | 193 | 468 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 468 | where | 195 | 468 | E: Error, | 196 | 468 | { | 197 | 468 | Ok(v as Self::Value) | 198 | 468 | } |
<<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Line | Count | Source | 193 | 581 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 581 | where | 195 | 581 | E: Error, | 196 | 581 | { | 197 | 581 | Ok(v as Self::Value) | 198 | 581 | } |
<<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Line | Count | Source | 193 | 874 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 874 | where | 195 | 874 | E: Error, | 196 | 874 | { | 197 | 874 | Ok(v as Self::Value) | 198 | 874 | } |
<<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Line | Count | Source | 193 | 472 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 194 | 472 | where | 195 | 472 | E: Error, | 196 | 472 | { | 197 | 472 | Ok(v as Self::Value) | 198 | 472 | } |
|
199 | | }; |
200 | | |
201 | | (nonzero $primitive:ident $ty:ident : $visit:ident) => { |
202 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
203 | 0 | where |
204 | 0 | E: Error, |
205 | 0 | { |
206 | 0 | if let Some(nonzero) = Self::Value::new(v as $primitive) { |
207 | 0 | Ok(nonzero) |
208 | | } else { |
209 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(0), &self)) |
210 | | } |
211 | 0 | } Unexecuted instantiation: <<core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> |
212 | | }; |
213 | | |
214 | | (saturating $primitive:ident $ty:ident : $visit:ident) => { |
215 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
216 | 0 | where |
217 | 0 | E: Error, |
218 | 0 | { |
219 | 0 | Ok(Saturating(v as $primitive)) |
220 | 0 | } Unexecuted instantiation: <<core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> |
221 | | }; |
222 | | } |
223 | | |
224 | | macro_rules! num_as_copysign_self { |
225 | | ($ty:ident : $visit:ident) => { |
226 | | #[inline] |
227 | 133k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
228 | 133k | where |
229 | 133k | E: Error, |
230 | 133k | { |
231 | | #[cfg(any(no_float_copysign, not(feature = "std")))] |
232 | | { |
233 | | Ok(v as Self::Value) |
234 | | } |
235 | | |
236 | | #[cfg(all(not(no_float_copysign), feature = "std"))] |
237 | | { |
238 | | // Preserve sign of NaN. The `as` produces a nondeterministic sign. |
239 | 133k | let sign = if v.is_sign_positive() { 1.0 } else { -1.0 }; |
240 | 133k | Ok((v as Self::Value).copysign(sign)) |
241 | 133k | } |
242 | 133k | } Unexecuted instantiation: <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_f64::<_> Unexecuted instantiation: <<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_f32::<_> <<f32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_f64::<ron::error::Error> Line | Count | Source | 227 | 3.02k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 228 | 3.02k | where | 229 | 3.02k | E: Error, | 230 | 3.02k | { | 231 | | #[cfg(any(no_float_copysign, not(feature = "std")))] | 232 | | { | 233 | | Ok(v as Self::Value) | 234 | | } | 235 | | | 236 | | #[cfg(all(not(no_float_copysign), feature = "std"))] | 237 | | { | 238 | | // Preserve sign of NaN. The `as` produces a nondeterministic sign. | 239 | 3.02k | let sign = if v.is_sign_positive() { 1.0 } else { -1.0 }; | 240 | 3.02k | Ok((v as Self::Value).copysign(sign)) | 241 | 3.02k | } | 242 | 3.02k | } |
<<f64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_f32::<ron::error::Error> Line | Count | Source | 227 | 130k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 228 | 130k | where | 229 | 130k | E: Error, | 230 | 130k | { | 231 | | #[cfg(any(no_float_copysign, not(feature = "std")))] | 232 | | { | 233 | | Ok(v as Self::Value) | 234 | | } | 235 | | | 236 | | #[cfg(all(not(no_float_copysign), feature = "std"))] | 237 | | { | 238 | | // Preserve sign of NaN. The `as` produces a nondeterministic sign. | 239 | 130k | let sign = if v.is_sign_positive() { 1.0 } else { -1.0 }; | 240 | 130k | Ok((v as Self::Value).copysign(sign)) | 241 | 130k | } | 242 | 130k | } |
|
243 | | }; |
244 | | } |
245 | | |
246 | | macro_rules! int_to_int { |
247 | | ($ty:ident : $visit:ident) => { |
248 | | #[inline] |
249 | 104k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
250 | 104k | where |
251 | 104k | E: Error, |
252 | 104k | { |
253 | 104k | if Self::Value::min_value() as i64 <= v as i64 |
254 | 104k | && v as i64 <= Self::Value::max_value() as i64 |
255 | | { |
256 | 104k | Ok(v as Self::Value) |
257 | | } else { |
258 | 0 | Err(Error::invalid_value(Unexpected::Signed(v as i64), &self)) |
259 | | } |
260 | 104k | } Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Line | Count | Source | 249 | 743 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 250 | 743 | where | 251 | 743 | E: Error, | 252 | 743 | { | 253 | 743 | if Self::Value::min_value() as i64 <= v as i64 | 254 | 743 | && v as i64 <= Self::Value::max_value() as i64 | 255 | | { | 256 | 743 | Ok(v as Self::Value) | 257 | | } else { | 258 | 0 | Err(Error::invalid_value(Unexpected::Signed(v as i64), &self)) | 259 | | } | 260 | 743 | } |
<<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Line | Count | Source | 249 | 103k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 250 | 103k | where | 251 | 103k | E: Error, | 252 | 103k | { | 253 | 103k | if Self::Value::min_value() as i64 <= v as i64 | 254 | 103k | && v as i64 <= Self::Value::max_value() as i64 | 255 | | { | 256 | 103k | Ok(v as Self::Value) | 257 | | } else { | 258 | 0 | Err(Error::invalid_value(Unexpected::Signed(v as i64), &self)) | 259 | | } | 260 | 103k | } |
|
261 | | }; |
262 | | |
263 | | (nonzero $primitive:ident $ty:ident : $visit:ident) => { |
264 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
265 | 0 | where |
266 | 0 | E: Error, |
267 | 0 | { |
268 | 0 | if $primitive::min_value() as i64 <= v as i64 |
269 | 0 | && v as i64 <= $primitive::max_value() as i64 |
270 | | { |
271 | 0 | if let Some(nonzero) = Self::Value::new(v as $primitive) { |
272 | 0 | return Ok(nonzero); |
273 | 0 | } |
274 | 0 | } |
275 | 0 | Err(Error::invalid_value(Unexpected::Signed(v as i64), &self)) |
276 | 0 | } Unexecuted instantiation: <<core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> |
277 | | }; |
278 | | |
279 | | (saturating $primitive:ident $ty:ident : $visit:ident) => { |
280 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
281 | 0 | where |
282 | 0 | E: Error, |
283 | 0 | { |
284 | 0 | if (v as i64) < $primitive::MIN as i64 { |
285 | 0 | Ok(Saturating($primitive::MIN)) |
286 | 0 | } else if ($primitive::MAX as i64) < v as i64 { |
287 | 0 | Ok(Saturating($primitive::MAX)) |
288 | | } else { |
289 | 0 | Ok(Saturating(v as $primitive)) |
290 | | } |
291 | 0 | } Unexecuted instantiation: <<core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> |
292 | | }; |
293 | | } |
294 | | |
295 | | macro_rules! int_to_uint { |
296 | | ($ty:ident : $visit:ident) => { |
297 | | #[inline] |
298 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
299 | 0 | where |
300 | 0 | E: Error, |
301 | 0 | { |
302 | 0 | if 0 <= v && v as u64 <= Self::Value::max_value() as u64 { |
303 | 0 | Ok(v as Self::Value) |
304 | | } else { |
305 | 0 | Err(Error::invalid_value(Unexpected::Signed(v as i64), &self)) |
306 | | } |
307 | 0 | } Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Unexecuted instantiation: <<u64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i8::<ron::error::Error> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i16::<ron::error::Error> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i32::<ron::error::Error> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i64::<ron::error::Error> |
308 | | }; |
309 | | |
310 | | (nonzero $primitive:ident $ty:ident : $visit:ident) => { |
311 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
312 | 0 | where |
313 | 0 | E: Error, |
314 | 0 | { |
315 | 0 | if 0 < v && v as u64 <= $primitive::max_value() as u64 { |
316 | 0 | if let Some(nonzero) = Self::Value::new(v as $primitive) { |
317 | 0 | return Ok(nonzero); |
318 | 0 | } |
319 | 0 | } |
320 | 0 | Err(Error::invalid_value(Unexpected::Signed(v as i64), &self)) |
321 | 0 | } Unexecuted instantiation: <<core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i64::<_> |
322 | | }; |
323 | | |
324 | | (saturating $primitive:ident $ty:ident : $visit:ident) => { |
325 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
326 | 0 | where |
327 | 0 | E: Error, |
328 | 0 | { |
329 | 0 | if v < 0 { |
330 | 0 | Ok(Saturating(0)) |
331 | 0 | } else if ($primitive::MAX as u64) < v as u64 { |
332 | 0 | Ok(Saturating($primitive::MAX)) |
333 | | } else { |
334 | 0 | Ok(Saturating(v as $primitive)) |
335 | | } |
336 | 0 | } Unexecuted instantiation: <<core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i64::<_> |
337 | | }; |
338 | | } |
339 | | |
340 | | macro_rules! uint_to_self { |
341 | | ($ty:ident : $visit:ident) => { |
342 | | #[inline] |
343 | 969k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
344 | 969k | where |
345 | 969k | E: Error, |
346 | 969k | { |
347 | 969k | if v as u64 <= Self::Value::max_value() as u64 { |
348 | 969k | Ok(v as Self::Value) |
349 | | } else { |
350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) |
351 | | } |
352 | 969k | } Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Unexecuted instantiation: <<u16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> Unexecuted instantiation: <<u32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> <<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Line | Count | Source | 343 | 897 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 897 | where | 345 | 897 | E: Error, | 346 | 897 | { | 347 | 897 | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 897 | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 897 | } |
<<usize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> Line | Count | Source | 343 | 90.4k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 90.4k | where | 345 | 90.4k | E: Error, | 346 | 90.4k | { | 347 | 90.4k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 90.4k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 90.4k | } |
<<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 343 | 10.6k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 10.6k | where | 345 | 10.6k | E: Error, | 346 | 10.6k | { | 347 | 10.6k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 10.6k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 10.6k | } |
Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Unexecuted instantiation: <<i8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 343 | 4.94k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 4.94k | where | 345 | 4.94k | E: Error, | 346 | 4.94k | { | 347 | 4.94k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 4.94k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 4.94k | } |
<<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Line | Count | Source | 343 | 1.80k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 1.80k | where | 345 | 1.80k | E: Error, | 346 | 1.80k | { | 347 | 1.80k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 1.80k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 1.80k | } |
Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Unexecuted instantiation: <<i16 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 343 | 383k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 383k | where | 345 | 383k | E: Error, | 346 | 383k | { | 347 | 383k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 383k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 383k | } |
<<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Line | Count | Source | 343 | 481 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 481 | where | 345 | 481 | E: Error, | 346 | 481 | { | 347 | 481 | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 481 | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 481 | } |
<<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Line | Count | Source | 343 | 2.70k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 2.70k | where | 345 | 2.70k | E: Error, | 346 | 2.70k | { | 347 | 2.70k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 2.70k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 2.70k | } |
Unexecuted instantiation: <<i32 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> <<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 343 | 35.0k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 35.0k | where | 345 | 35.0k | E: Error, | 346 | 35.0k | { | 347 | 35.0k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 35.0k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 35.0k | } |
<<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Line | Count | Source | 343 | 517 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 517 | where | 345 | 517 | E: Error, | 346 | 517 | { | 347 | 517 | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 517 | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 517 | } |
<<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Line | Count | Source | 343 | 944 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 944 | where | 345 | 944 | E: Error, | 346 | 944 | { | 347 | 944 | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 944 | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 944 | } |
<<i64 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> Line | Count | Source | 343 | 1.84k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 1.84k | where | 345 | 1.84k | E: Error, | 346 | 1.84k | { | 347 | 1.84k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 1.84k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 1.84k | } |
<<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u8::<ron::error::Error> Line | Count | Source | 343 | 431k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 431k | where | 345 | 431k | E: Error, | 346 | 431k | { | 347 | 431k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 431k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 431k | } |
<<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Line | Count | Source | 343 | 465 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 465 | where | 345 | 465 | E: Error, | 346 | 465 | { | 347 | 465 | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 465 | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 465 | } |
<<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Line | Count | Source | 343 | 682 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 682 | where | 345 | 682 | E: Error, | 346 | 682 | { | 347 | 682 | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 682 | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 682 | } |
<<isize as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> Line | Count | Source | 343 | 2.57k | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> | 344 | 2.57k | where | 345 | 2.57k | E: Error, | 346 | 2.57k | { | 347 | 2.57k | if v as u64 <= Self::Value::max_value() as u64 { | 348 | 2.57k | Ok(v as Self::Value) | 349 | | } else { | 350 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) | 351 | | } | 352 | 2.57k | } |
Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u16::<ron::error::Error> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u32::<ron::error::Error> Unexecuted instantiation: <<u8 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u64::<ron::error::Error> |
353 | | }; |
354 | | |
355 | | (nonzero $primitive:ident $ty:ident : $visit:ident) => { |
356 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
357 | 0 | where |
358 | 0 | E: Error, |
359 | 0 | { |
360 | 0 | if v as u64 <= $primitive::max_value() as u64 { |
361 | 0 | if let Some(nonzero) = Self::Value::new(v as $primitive) { |
362 | 0 | return Ok(nonzero); |
363 | 0 | } |
364 | 0 | } |
365 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) |
366 | 0 | } Unexecuted instantiation: <<core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<i64> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<isize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u8> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u16> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u32> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<usize> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u64::<_> |
367 | | }; |
368 | | |
369 | | (saturating $primitive:ident $ty:ident : $visit:ident) => { |
370 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
371 | 0 | where |
372 | 0 | E: Error, |
373 | 0 | { |
374 | 0 | if v as u64 <= $primitive::MAX as u64 { |
375 | 0 | Ok(Saturating(v as $primitive)) |
376 | | } else { |
377 | 0 | Ok(Saturating($primitive::MAX)) |
378 | | } |
379 | 0 | } Unexecuted instantiation: <<core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<i64> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u8::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<isize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u16::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u8> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u16> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u32> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u32::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<usize> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u64::<_> |
380 | | }; |
381 | | } |
382 | | |
383 | | impl_deserialize_num! { |
384 | | i8, NonZeroI8 cfg(not(no_num_nonzero_signed)), deserialize_i8 |
385 | | num_self!(i8:visit_i8); |
386 | | int_to_int!(i16:visit_i16 i32:visit_i32 i64:visit_i64); |
387 | | uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); |
388 | | } |
389 | | |
390 | | impl_deserialize_num! { |
391 | | i16, NonZeroI16 cfg(not(no_num_nonzero_signed)), deserialize_i16 |
392 | | num_self!(i16:visit_i16); |
393 | | num_as_self!(i8:visit_i8); |
394 | | int_to_int!(i32:visit_i32 i64:visit_i64); |
395 | | uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); |
396 | | } |
397 | | |
398 | | impl_deserialize_num! { |
399 | | i32, NonZeroI32 cfg(not(no_num_nonzero_signed)), deserialize_i32 |
400 | | num_self!(i32:visit_i32); |
401 | | num_as_self!(i8:visit_i8 i16:visit_i16); |
402 | | int_to_int!(i64:visit_i64); |
403 | | uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); |
404 | | } |
405 | | |
406 | | impl_deserialize_num! { |
407 | | i64, NonZeroI64 cfg(not(no_num_nonzero_signed)), deserialize_i64 |
408 | | num_self!(i64:visit_i64); |
409 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32); |
410 | | uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); |
411 | | } |
412 | | |
413 | | impl_deserialize_num! { |
414 | | isize, NonZeroIsize cfg(not(no_num_nonzero_signed)), deserialize_i64 |
415 | | num_as_self!(i8:visit_i8 i16:visit_i16); |
416 | | int_to_int!(i32:visit_i32 i64:visit_i64); |
417 | | uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); |
418 | | } |
419 | | |
420 | | impl_deserialize_num! { |
421 | | u8, NonZeroU8, deserialize_u8 |
422 | | num_self!(u8:visit_u8); |
423 | | int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); |
424 | | uint_to_self!(u16:visit_u16 u32:visit_u32 u64:visit_u64); |
425 | | } |
426 | | |
427 | | impl_deserialize_num! { |
428 | | u16, NonZeroU16, deserialize_u16 |
429 | | num_self!(u16:visit_u16); |
430 | | num_as_self!(u8:visit_u8); |
431 | | int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); |
432 | | uint_to_self!(u32:visit_u32 u64:visit_u64); |
433 | | } |
434 | | |
435 | | impl_deserialize_num! { |
436 | | u32, NonZeroU32, deserialize_u32 |
437 | | num_self!(u32:visit_u32); |
438 | | num_as_self!(u8:visit_u8 u16:visit_u16); |
439 | | int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); |
440 | | uint_to_self!(u64:visit_u64); |
441 | | } |
442 | | |
443 | | impl_deserialize_num! { |
444 | | u64, NonZeroU64, deserialize_u64 |
445 | | num_self!(u64:visit_u64); |
446 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32); |
447 | | int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); |
448 | | } |
449 | | |
450 | | impl_deserialize_num! { |
451 | | usize, NonZeroUsize, deserialize_u64 |
452 | | num_as_self!(u8:visit_u8 u16:visit_u16); |
453 | | int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); |
454 | | uint_to_self!(u32:visit_u32 u64:visit_u64); |
455 | | } |
456 | | |
457 | | impl_deserialize_num! { |
458 | | f32, deserialize_f32 |
459 | | num_self!(f32:visit_f32); |
460 | | num_as_copysign_self!(f64:visit_f64); |
461 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); |
462 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); |
463 | | } |
464 | | |
465 | | impl_deserialize_num! { |
466 | | f64, deserialize_f64 |
467 | | num_self!(f64:visit_f64); |
468 | | num_as_copysign_self!(f32:visit_f32); |
469 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); |
470 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); |
471 | | } |
472 | | |
473 | | macro_rules! num_128 { |
474 | | ($ty:ident : $visit:ident) => { |
475 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
476 | 0 | where |
477 | 0 | E: Error, |
478 | 0 | { |
479 | 0 | if v as i128 >= Self::Value::min_value() as i128 |
480 | 0 | && v as u128 <= Self::Value::max_value() as u128 |
481 | | { |
482 | 0 | Ok(v as Self::Value) |
483 | | } else { |
484 | 0 | Err(Error::invalid_value( |
485 | 0 | Unexpected::Other(stringify!($ty)), |
486 | 0 | &self, |
487 | 0 | )) |
488 | | } |
489 | 0 | } Unexecuted instantiation: <<i128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_u128::<_> Unexecuted instantiation: <<u128 as serde::de::Deserialize>::deserialize::PrimitiveVisitor as serde::de::Visitor>::visit_i128::<_> |
490 | | }; |
491 | | |
492 | | (nonzero $primitive:ident $ty:ident : $visit:ident) => { |
493 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
494 | 0 | where |
495 | 0 | E: Error, |
496 | 0 | { |
497 | 0 | if v as i128 >= $primitive::min_value() as i128 |
498 | 0 | && v as u128 <= $primitive::max_value() as u128 |
499 | | { |
500 | 0 | if let Some(nonzero) = Self::Value::new(v as $primitive) { |
501 | 0 | Ok(nonzero) |
502 | | } else { |
503 | 0 | Err(Error::invalid_value(Unexpected::Unsigned(0), &self)) |
504 | | } |
505 | | } else { |
506 | 0 | Err(Error::invalid_value( |
507 | 0 | Unexpected::Other(stringify!($ty)), |
508 | 0 | &self, |
509 | 0 | )) |
510 | | } |
511 | 0 | } Unexecuted instantiation: <<core::num::nonzero::NonZero<i128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_u128::<_> Unexecuted instantiation: <<core::num::nonzero::NonZero<u128> as serde::de::Deserialize>::deserialize::NonZeroVisitor as serde::de::Visitor>::visit_i128::<_> |
512 | | }; |
513 | | |
514 | | (saturating $primitive:ident $ty:ident : $visit:ident) => { |
515 | 0 | fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> |
516 | 0 | where |
517 | 0 | E: Error, |
518 | 0 | { |
519 | 0 | if (v as i128) < $primitive::MIN as i128 { |
520 | 0 | Ok(Saturating($primitive::MIN)) |
521 | 0 | } else if ($primitive::MAX as u128) < v as u128 { |
522 | 0 | Ok(Saturating($primitive::MAX)) |
523 | | } else { |
524 | 0 | Ok(Saturating(v as $primitive)) |
525 | | } |
526 | 0 | } Unexecuted instantiation: <<core::num::saturating::Saturating<i128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_u128::<_> Unexecuted instantiation: <<core::num::saturating::Saturating<u128> as serde::de::Deserialize>::deserialize::SaturatingVisitor as serde::de::Visitor>::visit_i128::<_> |
527 | | }; |
528 | | } |
529 | | |
530 | | impl_deserialize_num! { |
531 | | i128, NonZeroI128 cfg(not(no_num_nonzero_signed)), deserialize_i128 |
532 | | num_self!(i128:visit_i128); |
533 | | num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); |
534 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); |
535 | | num_128!(u128:visit_u128); |
536 | | } |
537 | | |
538 | | impl_deserialize_num! { |
539 | | u128, NonZeroU128, deserialize_u128 |
540 | | num_self!(u128:visit_u128); |
541 | | num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); |
542 | | int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); |
543 | | num_128!(i128:visit_i128); |
544 | | } |
545 | | |
546 | | //////////////////////////////////////////////////////////////////////////////// |
547 | | |
548 | | struct CharVisitor; |
549 | | |
550 | | impl<'de> Visitor<'de> for CharVisitor { |
551 | | type Value = char; |
552 | | |
553 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
554 | 0 | formatter.write_str("a character") |
555 | 0 | } |
556 | | |
557 | | #[inline] |
558 | 133k | fn visit_char<E>(self, v: char) -> Result<Self::Value, E> |
559 | 133k | where |
560 | 133k | E: Error, |
561 | 133k | { |
562 | 133k | Ok(v) |
563 | 133k | } Unexecuted instantiation: <serde::de::impls::CharVisitor as serde::de::Visitor>::visit_char::<_> <serde::de::impls::CharVisitor as serde::de::Visitor>::visit_char::<ron::error::Error> Line | Count | Source | 558 | 133k | fn visit_char<E>(self, v: char) -> Result<Self::Value, E> | 559 | 133k | where | 560 | 133k | E: Error, | 561 | 133k | { | 562 | 133k | Ok(v) | 563 | 133k | } |
|
564 | | |
565 | | #[inline] |
566 | 0 | fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> |
567 | 0 | where |
568 | 0 | E: Error, |
569 | 0 | { |
570 | 0 | let mut iter = v.chars(); |
571 | 0 | match (iter.next(), iter.next()) { |
572 | 0 | (Some(c), None) => Ok(c), |
573 | 0 | _ => Err(Error::invalid_value(Unexpected::Str(v), &self)), |
574 | | } |
575 | 0 | } Unexecuted instantiation: <serde::de::impls::CharVisitor as serde::de::Visitor>::visit_str::<_> Unexecuted instantiation: <serde::de::impls::CharVisitor as serde::de::Visitor>::visit_str::<ron::error::Error> |
576 | | } |
577 | | |
578 | | impl<'de> Deserialize<'de> for char { |
579 | | #[inline] |
580 | 133k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
581 | 133k | where |
582 | 133k | D: Deserializer<'de>, |
583 | 133k | { |
584 | 133k | deserializer.deserialize_char(CharVisitor) |
585 | 133k | } Unexecuted instantiation: <char as serde::de::Deserialize>::deserialize::<_> <char as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::Deserializer>> Line | Count | Source | 580 | 1.08k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 581 | 1.08k | where | 582 | 1.08k | D: Deserializer<'de>, | 583 | 1.08k | { | 584 | 1.08k | deserializer.deserialize_char(CharVisitor) | 585 | 1.08k | } |
Unexecuted instantiation: <char as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::CaptureKey<&mut ron::de::id::Deserializer>> <char as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::Deserializer>> Line | Count | Source | 580 | 56.6k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 581 | 56.6k | where | 582 | 56.6k | D: Deserializer<'de>, | 583 | 56.6k | { | 584 | 56.6k | deserializer.deserialize_char(CharVisitor) | 585 | 56.6k | } |
Unexecuted instantiation: <char as serde::de::Deserialize>::deserialize::<serde_path_to_error::de::Deserializer<&mut ron::de::tag::Deserializer>> Unexecuted instantiation: <char as serde::de::Deserialize>::deserialize::<serde::__private::de::FlatMapDeserializer<ron::error::Error>> <char as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentDeserializer<ron::error::Error>> Line | Count | Source | 580 | 47.7k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 581 | 47.7k | where | 582 | 47.7k | D: Deserializer<'de>, | 583 | 47.7k | { | 584 | 47.7k | deserializer.deserialize_char(CharVisitor) | 585 | 47.7k | } |
<char as serde::de::Deserialize>::deserialize::<serde::__private::de::content::ContentRefDeserializer<ron::error::Error>> Line | Count | Source | 580 | 26.3k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 581 | 26.3k | where | 582 | 26.3k | D: Deserializer<'de>, | 583 | 26.3k | { | 584 | 26.3k | deserializer.deserialize_char(CharVisitor) | 585 | 26.3k | } |
<char as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 580 | 1.30k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 581 | 1.30k | where | 582 | 1.30k | D: Deserializer<'de>, | 583 | 1.30k | { | 584 | 1.30k | deserializer.deserialize_char(CharVisitor) | 585 | 1.30k | } |
Unexecuted instantiation: <char as serde::de::Deserialize>::deserialize::<&mut ron::de::id::Deserializer> Unexecuted instantiation: <char as serde::de::Deserialize>::deserialize::<&mut ron::de::tag::Deserializer> |
586 | | } |
587 | | |
588 | | //////////////////////////////////////////////////////////////////////////////// |
589 | | |
590 | | #[cfg(any(feature = "std", feature = "alloc"))] |
591 | | struct StringVisitor; |
592 | | #[cfg(any(feature = "std", feature = "alloc"))] |
593 | | struct StringInPlaceVisitor<'a>(&'a mut String); |
594 | | |
595 | | #[cfg(any(feature = "std", feature = "alloc"))] |
596 | | impl<'de> Visitor<'de> for StringVisitor { |
597 | | type Value = String; |
598 | | |
599 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
600 | 0 | formatter.write_str("a string") |
601 | 0 | } |
602 | | |
603 | 24.5k | fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> |
604 | 24.5k | where |
605 | 24.5k | E: Error, |
606 | 24.5k | { |
607 | 24.5k | Ok(v.to_owned()) |
608 | 24.5k | } Unexecuted instantiation: <serde::de::impls::StringVisitor as serde::de::Visitor>::visit_str::<_> <serde::de::impls::StringVisitor as serde::de::Visitor>::visit_str::<ron::error::Error> Line | Count | Source | 603 | 24.5k | fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> | 604 | 24.5k | where | 605 | 24.5k | E: Error, | 606 | 24.5k | { | 607 | 24.5k | Ok(v.to_owned()) | 608 | 24.5k | } |
|
609 | | |
610 | 4.59k | fn visit_string<E>(self, v: String) -> Result<Self::Value, E> |
611 | 4.59k | where |
612 | 4.59k | E: Error, |
613 | 4.59k | { |
614 | 4.59k | Ok(v) |
615 | 4.59k | } Unexecuted instantiation: <serde::de::impls::StringVisitor as serde::de::Visitor>::visit_string::<_> <serde::de::impls::StringVisitor as serde::de::Visitor>::visit_string::<ron::error::Error> Line | Count | Source | 610 | 4.59k | fn visit_string<E>(self, v: String) -> Result<Self::Value, E> | 611 | 4.59k | where | 612 | 4.59k | E: Error, | 613 | 4.59k | { | 614 | 4.59k | Ok(v) | 615 | 4.59k | } |
|
616 | | |
617 | 0 | fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E> |
618 | 0 | where |
619 | 0 | E: Error, |
620 | 0 | { |
621 | 0 | match str::from_utf8(v) { |
622 | 0 | Ok(s) => Ok(s.to_owned()), |
623 | 0 | Err(_) => Err(Error::invalid_value(Unexpected::Bytes(v), &self)), |
624 | | } |
625 | 0 | } |
626 | | |
627 | 0 | fn visit_byte_buf<E>(self, v: Vec<u8>) -> Result<Self::Value, E> |
628 | 0 | where |
629 | 0 | E: Error, |
630 | 0 | { |
631 | 0 | match String::from_utf8(v) { |
632 | 0 | Ok(s) => Ok(s), |
633 | 0 | Err(e) => Err(Error::invalid_value( |
634 | 0 | Unexpected::Bytes(&e.into_bytes()), |
635 | 0 | &self, |
636 | 0 | )), |
637 | | } |
638 | 0 | } |
639 | | } |
640 | | |
641 | | #[cfg(any(feature = "std", feature = "alloc"))] |
642 | | impl<'a, 'de> Visitor<'de> for StringInPlaceVisitor<'a> { |
643 | | type Value = (); |
644 | | |
645 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
646 | 0 | formatter.write_str("a string") |
647 | 0 | } |
648 | | |
649 | 0 | fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> |
650 | 0 | where |
651 | 0 | E: Error, |
652 | 0 | { |
653 | 0 | self.0.clear(); |
654 | 0 | self.0.push_str(v); |
655 | 0 | Ok(()) |
656 | 0 | } |
657 | | |
658 | 0 | fn visit_string<E>(self, v: String) -> Result<Self::Value, E> |
659 | 0 | where |
660 | 0 | E: Error, |
661 | 0 | { |
662 | 0 | *self.0 = v; |
663 | 0 | Ok(()) |
664 | 0 | } |
665 | | |
666 | 0 | fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E> |
667 | 0 | where |
668 | 0 | E: Error, |
669 | 0 | { |
670 | 0 | match str::from_utf8(v) { |
671 | 0 | Ok(s) => { |
672 | 0 | self.0.clear(); |
673 | 0 | self.0.push_str(s); |
674 | 0 | Ok(()) |
675 | | } |
676 | 0 | Err(_) => Err(Error::invalid_value(Unexpected::Bytes(v), &self)), |
677 | | } |
678 | 0 | } |
679 | | |
680 | 0 | fn visit_byte_buf<E>(self, v: Vec<u8>) -> Result<Self::Value, E> |
681 | 0 | where |
682 | 0 | E: Error, |
683 | 0 | { |
684 | 0 | match String::from_utf8(v) { |
685 | 0 | Ok(s) => { |
686 | 0 | *self.0 = s; |
687 | 0 | Ok(()) |
688 | | } |
689 | 0 | Err(e) => Err(Error::invalid_value( |
690 | 0 | Unexpected::Bytes(&e.into_bytes()), |
691 | 0 | &self, |
692 | 0 | )), |
693 | | } |
694 | 0 | } |
695 | | } |
696 | | |
697 | | #[cfg(any(feature = "std", feature = "alloc"))] |
698 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
699 | | impl<'de> Deserialize<'de> for String { |
700 | 29.6k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
701 | 29.6k | where |
702 | 29.6k | D: Deserializer<'de>, |
703 | 29.6k | { |
704 | 29.6k | deserializer.deserialize_string(StringVisitor) |
705 | 29.6k | } Unexecuted instantiation: <alloc::string::String as serde::de::Deserialize>::deserialize::<_> <alloc::string::String as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Line | Count | Source | 700 | 29.6k | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | 701 | 29.6k | where | 702 | 29.6k | D: Deserializer<'de>, | 703 | 29.6k | { | 704 | 29.6k | deserializer.deserialize_string(StringVisitor) | 705 | 29.6k | } |
|
706 | | |
707 | 0 | fn deserialize_in_place<D>(deserializer: D, place: &mut Self) -> Result<(), D::Error> |
708 | 0 | where |
709 | 0 | D: Deserializer<'de>, |
710 | 0 | { |
711 | 0 | deserializer.deserialize_string(StringInPlaceVisitor(place)) |
712 | 0 | } |
713 | | } |
714 | | |
715 | | //////////////////////////////////////////////////////////////////////////////// |
716 | | |
717 | | struct StrVisitor; |
718 | | |
719 | | impl<'a> Visitor<'a> for StrVisitor { |
720 | | type Value = &'a str; |
721 | | |
722 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
723 | 0 | formatter.write_str("a borrowed string") |
724 | 0 | } |
725 | | |
726 | 0 | fn visit_borrowed_str<E>(self, v: &'a str) -> Result<Self::Value, E> |
727 | 0 | where |
728 | 0 | E: Error, |
729 | 0 | { |
730 | 0 | Ok(v) // so easy |
731 | 0 | } |
732 | | |
733 | 0 | fn visit_borrowed_bytes<E>(self, v: &'a [u8]) -> Result<Self::Value, E> |
734 | 0 | where |
735 | 0 | E: Error, |
736 | 0 | { |
737 | 0 | str::from_utf8(v).map_err(|_| Error::invalid_value(Unexpected::Bytes(v), &self)) |
738 | 0 | } |
739 | | } |
740 | | |
741 | | impl<'de: 'a, 'a> Deserialize<'de> for &'a str { |
742 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
743 | 0 | where |
744 | 0 | D: Deserializer<'de>, |
745 | 0 | { |
746 | 0 | deserializer.deserialize_str(StrVisitor) |
747 | 0 | } |
748 | | } |
749 | | |
750 | | //////////////////////////////////////////////////////////////////////////////// |
751 | | |
752 | | struct BytesVisitor; |
753 | | |
754 | | impl<'a> Visitor<'a> for BytesVisitor { |
755 | | type Value = &'a [u8]; |
756 | | |
757 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
758 | 0 | formatter.write_str("a borrowed byte array") |
759 | 0 | } |
760 | | |
761 | 0 | fn visit_borrowed_bytes<E>(self, v: &'a [u8]) -> Result<Self::Value, E> |
762 | 0 | where |
763 | 0 | E: Error, |
764 | 0 | { |
765 | 0 | Ok(v) |
766 | 0 | } |
767 | | |
768 | 0 | fn visit_borrowed_str<E>(self, v: &'a str) -> Result<Self::Value, E> |
769 | 0 | where |
770 | 0 | E: Error, |
771 | 0 | { |
772 | 0 | Ok(v.as_bytes()) |
773 | 0 | } |
774 | | } |
775 | | |
776 | | impl<'de: 'a, 'a> Deserialize<'de> for &'a [u8] { |
777 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
778 | 0 | where |
779 | 0 | D: Deserializer<'de>, |
780 | 0 | { |
781 | 0 | deserializer.deserialize_bytes(BytesVisitor) |
782 | 0 | } |
783 | | } |
784 | | |
785 | | //////////////////////////////////////////////////////////////////////////////// |
786 | | |
787 | | #[cfg(any(feature = "std", all(not(no_core_cstr), feature = "alloc")))] |
788 | | struct CStringVisitor; |
789 | | |
790 | | #[cfg(any(feature = "std", all(not(no_core_cstr), feature = "alloc")))] |
791 | | impl<'de> Visitor<'de> for CStringVisitor { |
792 | | type Value = CString; |
793 | | |
794 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
795 | 0 | formatter.write_str("byte array") |
796 | 0 | } |
797 | | |
798 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
799 | 0 | where |
800 | 0 | A: SeqAccess<'de>, |
801 | 0 | { |
802 | 0 | let capacity = size_hint::cautious::<u8>(seq.size_hint()); |
803 | 0 | let mut values = Vec::<u8>::with_capacity(capacity); |
804 | | |
805 | 0 | while let Some(value) = tri!(seq.next_element()) { |
806 | 0 | values.push(value); |
807 | 0 | } |
808 | | |
809 | 0 | CString::new(values).map_err(Error::custom) |
810 | 0 | } |
811 | | |
812 | 0 | fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E> |
813 | 0 | where |
814 | 0 | E: Error, |
815 | 0 | { |
816 | 0 | CString::new(v).map_err(Error::custom) |
817 | 0 | } |
818 | | |
819 | 0 | fn visit_byte_buf<E>(self, v: Vec<u8>) -> Result<Self::Value, E> |
820 | 0 | where |
821 | 0 | E: Error, |
822 | 0 | { |
823 | 0 | CString::new(v).map_err(Error::custom) |
824 | 0 | } |
825 | | |
826 | 0 | fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> |
827 | 0 | where |
828 | 0 | E: Error, |
829 | 0 | { |
830 | 0 | CString::new(v).map_err(Error::custom) |
831 | 0 | } |
832 | | |
833 | 0 | fn visit_string<E>(self, v: String) -> Result<Self::Value, E> |
834 | 0 | where |
835 | 0 | E: Error, |
836 | 0 | { |
837 | 0 | CString::new(v).map_err(Error::custom) |
838 | 0 | } |
839 | | } |
840 | | |
841 | | #[cfg(any(feature = "std", all(not(no_core_cstr), feature = "alloc")))] |
842 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
843 | | impl<'de> Deserialize<'de> for CString { |
844 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
845 | 0 | where |
846 | 0 | D: Deserializer<'de>, |
847 | 0 | { |
848 | 0 | deserializer.deserialize_byte_buf(CStringVisitor) |
849 | 0 | } |
850 | | } |
851 | | |
852 | | macro_rules! forwarded_impl { |
853 | | ( |
854 | | $(#[$attr:meta])* |
855 | | ($($id:ident),*), $ty:ty, $func:expr |
856 | | ) => { |
857 | | $(#[$attr])* |
858 | | impl<'de $(, $id : Deserialize<'de>,)*> Deserialize<'de> for $ty { |
859 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
860 | 0 | where |
861 | 0 | D: Deserializer<'de>, |
862 | 0 | { |
863 | 0 | Deserialize::deserialize(deserializer).map($func) |
864 | 0 | } Unexecuted instantiation: <alloc::boxed::Box<core::ffi::c_str::CStr> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::cmp::Reverse<_> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <alloc::boxed::Box<std::path::Path> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <alloc::boxed::Box<_> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <alloc::boxed::Box<[_]> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <alloc::boxed::Box<str> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <alloc::boxed::Box<std::ffi::os_str::OsStr> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::cell::RefCell<_> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <std::sync::mutex::Mutex<_> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <std::sync::rwlock::RwLock<_> as serde::de::Deserialize>::deserialize::<_> |
865 | | } |
866 | | } |
867 | | } |
868 | | |
869 | | forwarded_impl! { |
870 | | #[cfg(any(feature = "std", all(not(no_core_cstr), feature = "alloc")))] |
871 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
872 | | (), Box<CStr>, CString::into_boxed_c_str |
873 | | } |
874 | | |
875 | | forwarded_impl! { |
876 | | (T), Reverse<T>, Reverse |
877 | | } |
878 | | |
879 | | //////////////////////////////////////////////////////////////////////////////// |
880 | | |
881 | | struct OptionVisitor<T> { |
882 | | marker: PhantomData<T>, |
883 | | } |
884 | | |
885 | | impl<'de, T> Visitor<'de> for OptionVisitor<T> |
886 | | where |
887 | | T: Deserialize<'de>, |
888 | | { |
889 | | type Value = Option<T>; |
890 | | |
891 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
892 | 0 | formatter.write_str("option") |
893 | 0 | } |
894 | | |
895 | | #[inline] |
896 | 0 | fn visit_unit<E>(self) -> Result<Self::Value, E> |
897 | 0 | where |
898 | 0 | E: Error, |
899 | 0 | { |
900 | 0 | Ok(None) |
901 | 0 | } |
902 | | |
903 | | #[inline] |
904 | 0 | fn visit_none<E>(self) -> Result<Self::Value, E> |
905 | 0 | where |
906 | 0 | E: Error, |
907 | 0 | { |
908 | 0 | Ok(None) |
909 | 0 | } |
910 | | |
911 | | #[inline] |
912 | 0 | fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error> |
913 | 0 | where |
914 | 0 | D: Deserializer<'de>, |
915 | 0 | { |
916 | 0 | T::deserialize(deserializer).map(Some) |
917 | 0 | } |
918 | | |
919 | 0 | fn __private_visit_untagged_option<D>(self, deserializer: D) -> Result<Self::Value, ()> |
920 | 0 | where |
921 | 0 | D: Deserializer<'de>, |
922 | 0 | { |
923 | 0 | Ok(T::deserialize(deserializer).ok()) |
924 | 0 | } |
925 | | } |
926 | | |
927 | | impl<'de, T> Deserialize<'de> for Option<T> |
928 | | where |
929 | | T: Deserialize<'de>, |
930 | | { |
931 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
932 | 0 | where |
933 | 0 | D: Deserializer<'de>, |
934 | 0 | { |
935 | 0 | deserializer.deserialize_option(OptionVisitor { |
936 | 0 | marker: PhantomData, |
937 | 0 | }) |
938 | 0 | } |
939 | | |
940 | | // The Some variant's repr is opaque, so we can't play cute tricks with its |
941 | | // tag to have deserialize_in_place build the content in place unconditionally. |
942 | | // |
943 | | // FIXME: investigate whether branching on the old value being Some to |
944 | | // deserialize_in_place the value is profitable (probably data-dependent?) |
945 | | } |
946 | | |
947 | | //////////////////////////////////////////////////////////////////////////////// |
948 | | |
949 | | struct PhantomDataVisitor<T: ?Sized> { |
950 | | marker: PhantomData<T>, |
951 | | } |
952 | | |
953 | | impl<'de, T> Visitor<'de> for PhantomDataVisitor<T> |
954 | | where |
955 | | T: ?Sized, |
956 | | { |
957 | | type Value = PhantomData<T>; |
958 | | |
959 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
960 | 0 | formatter.write_str("unit") |
961 | 0 | } |
962 | | |
963 | | #[inline] |
964 | 0 | fn visit_unit<E>(self) -> Result<Self::Value, E> |
965 | 0 | where |
966 | 0 | E: Error, |
967 | 0 | { |
968 | 0 | Ok(PhantomData) |
969 | 0 | } |
970 | | } |
971 | | |
972 | | impl<'de, T> Deserialize<'de> for PhantomData<T> |
973 | | where |
974 | | T: ?Sized, |
975 | | { |
976 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
977 | 0 | where |
978 | 0 | D: Deserializer<'de>, |
979 | 0 | { |
980 | 0 | let visitor = PhantomDataVisitor { |
981 | 0 | marker: PhantomData, |
982 | 0 | }; |
983 | 0 | deserializer.deserialize_unit_struct("PhantomData", visitor) |
984 | 0 | } |
985 | | } |
986 | | |
987 | | //////////////////////////////////////////////////////////////////////////////// |
988 | | |
989 | | macro_rules! seq_impl { |
990 | | ( |
991 | | $(#[$attr:meta])* |
992 | | $ty:ident <T $(: $tbound1:ident $(+ $tbound2:ident)*)* $(, $typaram:ident : $bound1:ident $(+ $bound2:ident)*)*>, |
993 | | $access:ident, |
994 | | $clear:expr, |
995 | | $with_capacity:expr, |
996 | | $reserve:expr, |
997 | | $insert:expr |
998 | | ) => { |
999 | | $(#[$attr])* |
1000 | | impl<'de, T $(, $typaram)*> Deserialize<'de> for $ty<T $(, $typaram)*> |
1001 | | where |
1002 | | T: Deserialize<'de> $(+ $tbound1 $(+ $tbound2)*)*, |
1003 | | $($typaram: $bound1 $(+ $bound2)*,)* |
1004 | | { |
1005 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1006 | 0 | where |
1007 | 0 | D: Deserializer<'de>, |
1008 | 0 | { |
1009 | | struct SeqVisitor<T $(, $typaram)*> { |
1010 | | marker: PhantomData<$ty<T $(, $typaram)*>>, |
1011 | | } |
1012 | | |
1013 | | impl<'de, T $(, $typaram)*> Visitor<'de> for SeqVisitor<T $(, $typaram)*> |
1014 | | where |
1015 | | T: Deserialize<'de> $(+ $tbound1 $(+ $tbound2)*)*, |
1016 | | $($typaram: $bound1 $(+ $bound2)*,)* |
1017 | | { |
1018 | | type Value = $ty<T $(, $typaram)*>; |
1019 | | |
1020 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1021 | 0 | formatter.write_str("a sequence") |
1022 | 0 | } Unexecuted instantiation: <<alloc::collections::binary_heap::BinaryHeap<_> as serde::de::Deserialize>::deserialize::SeqVisitor<_> as serde::de::Visitor>::expecting Unexecuted instantiation: <<alloc::collections::btree::set::BTreeSet<_> as serde::de::Deserialize>::deserialize::SeqVisitor<_> as serde::de::Visitor>::expecting Unexecuted instantiation: <<alloc::collections::linked_list::LinkedList<_> as serde::de::Deserialize>::deserialize::SeqVisitor<_> as serde::de::Visitor>::expecting Unexecuted instantiation: <<std::collections::hash::set::HashSet<_, _> as serde::de::Deserialize>::deserialize::SeqVisitor<_, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<alloc::collections::vec_deque::VecDeque<_> as serde::de::Deserialize>::deserialize::SeqVisitor<_> as serde::de::Visitor>::expecting |
1023 | | |
1024 | | #[inline] |
1025 | 0 | fn visit_seq<A>(self, mut $access: A) -> Result<Self::Value, A::Error> |
1026 | 0 | where |
1027 | 0 | A: SeqAccess<'de>, |
1028 | 0 | { |
1029 | 0 | let mut values = $with_capacity; |
1030 | | |
1031 | 0 | while let Some(value) = tri!($access.next_element()) { |
1032 | 0 | $insert(&mut values, value); |
1033 | 0 | } |
1034 | | |
1035 | 0 | Ok(values) |
1036 | 0 | } Unexecuted instantiation: <<alloc::collections::binary_heap::BinaryHeap<_> as serde::de::Deserialize>::deserialize::SeqVisitor<_> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<alloc::collections::btree::set::BTreeSet<_> as serde::de::Deserialize>::deserialize::SeqVisitor<_> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<alloc::collections::linked_list::LinkedList<_> as serde::de::Deserialize>::deserialize::SeqVisitor<_> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<std::collections::hash::set::HashSet<_, _> as serde::de::Deserialize>::deserialize::SeqVisitor<_, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<alloc::collections::vec_deque::VecDeque<_> as serde::de::Deserialize>::deserialize::SeqVisitor<_> as serde::de::Visitor>::visit_seq::<_> |
1037 | | } |
1038 | | |
1039 | 0 | let visitor = SeqVisitor { marker: PhantomData }; |
1040 | 0 | deserializer.deserialize_seq(visitor) |
1041 | 0 | } Unexecuted instantiation: <alloc::collections::binary_heap::BinaryHeap<_> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <alloc::collections::btree::set::BTreeSet<_> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <alloc::collections::linked_list::LinkedList<_> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <std::collections::hash::set::HashSet<_, _> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <alloc::collections::vec_deque::VecDeque<_> as serde::de::Deserialize>::deserialize::<_> |
1042 | | |
1043 | 0 | fn deserialize_in_place<D>(deserializer: D, place: &mut Self) -> Result<(), D::Error> |
1044 | 0 | where |
1045 | 0 | D: Deserializer<'de>, |
1046 | 0 | { |
1047 | | struct SeqInPlaceVisitor<'a, T: 'a $(, $typaram: 'a)*>(&'a mut $ty<T $(, $typaram)*>); |
1048 | | |
1049 | | impl<'a, 'de, T $(, $typaram)*> Visitor<'de> for SeqInPlaceVisitor<'a, T $(, $typaram)*> |
1050 | | where |
1051 | | T: Deserialize<'de> $(+ $tbound1 $(+ $tbound2)*)*, |
1052 | | $($typaram: $bound1 $(+ $bound2)*,)* |
1053 | | { |
1054 | | type Value = (); |
1055 | | |
1056 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1057 | 0 | formatter.write_str("a sequence") |
1058 | 0 | } Unexecuted instantiation: <<alloc::collections::binary_heap::BinaryHeap<_> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_> as serde::de::Visitor>::expecting Unexecuted instantiation: <<alloc::collections::btree::set::BTreeSet<_> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_> as serde::de::Visitor>::expecting Unexecuted instantiation: <<alloc::collections::linked_list::LinkedList<_> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_> as serde::de::Visitor>::expecting Unexecuted instantiation: <<std::collections::hash::set::HashSet<_, _> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<alloc::collections::vec_deque::VecDeque<_> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_> as serde::de::Visitor>::expecting |
1059 | | |
1060 | | #[inline] |
1061 | 0 | fn visit_seq<A>(mut self, mut $access: A) -> Result<Self::Value, A::Error> |
1062 | 0 | where |
1063 | 0 | A: SeqAccess<'de>, |
1064 | 0 | { |
1065 | 0 | $clear(&mut self.0); |
1066 | 0 | $reserve(&mut self.0, size_hint::cautious::<T>($access.size_hint())); |
1067 | | |
1068 | | // FIXME: try to overwrite old values here? (Vec, VecDeque, LinkedList) |
1069 | 0 | while let Some(value) = tri!($access.next_element()) { |
1070 | 0 | $insert(&mut self.0, value); |
1071 | 0 | } |
1072 | | |
1073 | 0 | Ok(()) |
1074 | 0 | } Unexecuted instantiation: <<alloc::collections::binary_heap::BinaryHeap<_> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<alloc::collections::btree::set::BTreeSet<_> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<alloc::collections::linked_list::LinkedList<_> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<std::collections::hash::set::HashSet<_, _> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<alloc::collections::vec_deque::VecDeque<_> as serde::de::Deserialize>::deserialize_in_place::SeqInPlaceVisitor<_> as serde::de::Visitor>::visit_seq::<_> |
1075 | | } |
1076 | | |
1077 | 0 | deserializer.deserialize_seq(SeqInPlaceVisitor(place)) |
1078 | 0 | } Unexecuted instantiation: <alloc::collections::binary_heap::BinaryHeap<_> as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <alloc::collections::btree::set::BTreeSet<_> as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <alloc::collections::linked_list::LinkedList<_> as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <std::collections::hash::set::HashSet<_, _> as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <alloc::collections::vec_deque::VecDeque<_> as serde::de::Deserialize>::deserialize_in_place::<_> |
1079 | | } |
1080 | | } |
1081 | | } |
1082 | | |
1083 | | // Dummy impl of reserve |
1084 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1085 | 0 | fn nop_reserve<T>(_seq: T, _n: usize) {} |
1086 | | |
1087 | | seq_impl!( |
1088 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1089 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1090 | | BinaryHeap<T: Ord>, |
1091 | | seq, |
1092 | | BinaryHeap::clear, |
1093 | | BinaryHeap::with_capacity(size_hint::cautious::<T>(seq.size_hint())), |
1094 | | BinaryHeap::reserve, |
1095 | | BinaryHeap::push |
1096 | | ); |
1097 | | |
1098 | | seq_impl!( |
1099 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1100 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1101 | | BTreeSet<T: Eq + Ord>, |
1102 | | seq, |
1103 | | BTreeSet::clear, |
1104 | | BTreeSet::new(), |
1105 | | nop_reserve, |
1106 | | BTreeSet::insert |
1107 | | ); |
1108 | | |
1109 | | seq_impl!( |
1110 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1111 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1112 | | LinkedList<T>, |
1113 | | seq, |
1114 | | LinkedList::clear, |
1115 | | LinkedList::new(), |
1116 | | nop_reserve, |
1117 | | LinkedList::push_back |
1118 | | ); |
1119 | | |
1120 | | seq_impl!( |
1121 | | #[cfg(feature = "std")] |
1122 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] |
1123 | | HashSet<T: Eq + Hash, S: BuildHasher + Default>, |
1124 | | seq, |
1125 | | HashSet::clear, |
1126 | | HashSet::with_capacity_and_hasher(size_hint::cautious::<T>(seq.size_hint()), S::default()), |
1127 | | HashSet::reserve, |
1128 | | HashSet::insert |
1129 | | ); |
1130 | | |
1131 | | seq_impl!( |
1132 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1133 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1134 | | VecDeque<T>, |
1135 | | seq, |
1136 | | VecDeque::clear, |
1137 | | VecDeque::with_capacity(size_hint::cautious::<T>(seq.size_hint())), |
1138 | | VecDeque::reserve, |
1139 | | VecDeque::push_back |
1140 | | ); |
1141 | | |
1142 | | //////////////////////////////////////////////////////////////////////////////// |
1143 | | |
1144 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1145 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1146 | | impl<'de, T> Deserialize<'de> for Vec<T> |
1147 | | where |
1148 | | T: Deserialize<'de>, |
1149 | | { |
1150 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1151 | 0 | where |
1152 | 0 | D: Deserializer<'de>, |
1153 | 0 | { |
1154 | | struct VecVisitor<T> { |
1155 | | marker: PhantomData<T>, |
1156 | | } |
1157 | | |
1158 | | impl<'de, T> Visitor<'de> for VecVisitor<T> |
1159 | | where |
1160 | | T: Deserialize<'de>, |
1161 | | { |
1162 | | type Value = Vec<T>; |
1163 | | |
1164 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1165 | 0 | formatter.write_str("a sequence") |
1166 | 0 | } |
1167 | | |
1168 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
1169 | 0 | where |
1170 | 0 | A: SeqAccess<'de>, |
1171 | 0 | { |
1172 | 0 | let capacity = size_hint::cautious::<T>(seq.size_hint()); |
1173 | 0 | let mut values = Vec::<T>::with_capacity(capacity); |
1174 | | |
1175 | 0 | while let Some(value) = tri!(seq.next_element()) { |
1176 | 0 | values.push(value); |
1177 | 0 | } |
1178 | | |
1179 | 0 | Ok(values) |
1180 | 0 | } Unexecuted instantiation: <<alloc::vec::Vec<_> as serde::de::Deserialize>::deserialize::VecVisitor<u8> as serde::de::Visitor>::visit_seq::<ron::de::CommaSeparated> Unexecuted instantiation: <<alloc::vec::Vec<_> as serde::de::Deserialize>::deserialize::VecVisitor<_> as serde::de::Visitor>::visit_seq::<_> |
1181 | | } |
1182 | | |
1183 | 0 | let visitor = VecVisitor { |
1184 | 0 | marker: PhantomData, |
1185 | 0 | }; |
1186 | 0 | deserializer.deserialize_seq(visitor) |
1187 | 0 | } Unexecuted instantiation: <alloc::vec::Vec<u8> as serde::de::Deserialize>::deserialize::<&mut ron::de::Deserializer> Unexecuted instantiation: <alloc::vec::Vec<_> as serde::de::Deserialize>::deserialize::<_> |
1188 | | |
1189 | 0 | fn deserialize_in_place<D>(deserializer: D, place: &mut Self) -> Result<(), D::Error> |
1190 | 0 | where |
1191 | 0 | D: Deserializer<'de>, |
1192 | 0 | { |
1193 | | struct VecInPlaceVisitor<'a, T: 'a>(&'a mut Vec<T>); |
1194 | | |
1195 | | impl<'a, 'de, T> Visitor<'de> for VecInPlaceVisitor<'a, T> |
1196 | | where |
1197 | | T: Deserialize<'de>, |
1198 | | { |
1199 | | type Value = (); |
1200 | | |
1201 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1202 | 0 | formatter.write_str("a sequence") |
1203 | 0 | } |
1204 | | |
1205 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
1206 | 0 | where |
1207 | 0 | A: SeqAccess<'de>, |
1208 | 0 | { |
1209 | 0 | let hint = size_hint::cautious::<T>(seq.size_hint()); |
1210 | 0 | if let Some(additional) = hint.checked_sub(self.0.len()) { |
1211 | 0 | self.0.reserve(additional); |
1212 | 0 | } |
1213 | | |
1214 | 0 | for i in 0..self.0.len() { |
1215 | 0 | let next = { |
1216 | 0 | let next_place = InPlaceSeed(&mut self.0[i]); |
1217 | 0 | tri!(seq.next_element_seed(next_place)) |
1218 | | }; |
1219 | 0 | if next.is_none() { |
1220 | 0 | self.0.truncate(i); |
1221 | 0 | return Ok(()); |
1222 | 0 | } |
1223 | | } |
1224 | | |
1225 | 0 | while let Some(value) = tri!(seq.next_element()) { |
1226 | 0 | self.0.push(value); |
1227 | 0 | } |
1228 | | |
1229 | 0 | Ok(()) |
1230 | 0 | } |
1231 | | } |
1232 | | |
1233 | 0 | deserializer.deserialize_seq(VecInPlaceVisitor(place)) |
1234 | 0 | } |
1235 | | } |
1236 | | |
1237 | | //////////////////////////////////////////////////////////////////////////////// |
1238 | | |
1239 | | struct ArrayVisitor<A> { |
1240 | | marker: PhantomData<A>, |
1241 | | } |
1242 | | struct ArrayInPlaceVisitor<'a, A: 'a>(&'a mut A); |
1243 | | |
1244 | | impl<A> ArrayVisitor<A> { |
1245 | 0 | fn new() -> Self { |
1246 | 0 | ArrayVisitor { |
1247 | 0 | marker: PhantomData, |
1248 | 0 | } |
1249 | 0 | } |
1250 | | } |
1251 | | |
1252 | | impl<'de, T> Visitor<'de> for ArrayVisitor<[T; 0]> { |
1253 | | type Value = [T; 0]; |
1254 | | |
1255 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1256 | 0 | formatter.write_str("an empty array") |
1257 | 0 | } |
1258 | | |
1259 | | #[inline] |
1260 | 0 | fn visit_seq<A>(self, _: A) -> Result<Self::Value, A::Error> |
1261 | 0 | where |
1262 | 0 | A: SeqAccess<'de>, |
1263 | 0 | { |
1264 | 0 | Ok([]) |
1265 | 0 | } |
1266 | | } |
1267 | | |
1268 | | // Does not require T: Deserialize<'de>. |
1269 | | impl<'de, T> Deserialize<'de> for [T; 0] { |
1270 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1271 | 0 | where |
1272 | 0 | D: Deserializer<'de>, |
1273 | 0 | { |
1274 | 0 | deserializer.deserialize_tuple(0, ArrayVisitor::<[T; 0]>::new()) |
1275 | 0 | } |
1276 | | } |
1277 | | |
1278 | | macro_rules! array_impls { |
1279 | | ($($len:expr => ($($n:tt)+))+) => { |
1280 | | $( |
1281 | | impl<'de, T> Visitor<'de> for ArrayVisitor<[T; $len]> |
1282 | | where |
1283 | | T: Deserialize<'de>, |
1284 | | { |
1285 | | type Value = [T; $len]; |
1286 | | |
1287 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1288 | 0 | formatter.write_str(concat!("an array of length ", $len)) |
1289 | 0 | } Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 1]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 2]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 3]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 4]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 5]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 6]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 7]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 8]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 9]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 10]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 11]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 12]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 13]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 14]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 15]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 16]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 17]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 18]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 19]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 20]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 21]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 22]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 23]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 24]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 25]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 26]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 27]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 28]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 29]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 30]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 31]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 32]> as serde::de::Visitor>::expecting |
1290 | | |
1291 | | #[inline] |
1292 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
1293 | 0 | where |
1294 | 0 | A: SeqAccess<'de>, |
1295 | 0 | { |
1296 | | Ok([$( |
1297 | 0 | match tri!(seq.next_element()) { |
1298 | 0 | Some(val) => val, |
1299 | 0 | None => return Err(Error::invalid_length($n, &self)), |
1300 | | } |
1301 | | ),+]) |
1302 | 0 | } Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 1]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 2]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 3]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 4]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 5]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 6]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 7]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 8]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 9]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 10]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 11]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 12]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 13]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 14]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 15]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 16]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 17]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 18]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 19]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 20]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 21]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 22]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 23]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 24]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 25]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 26]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 27]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 28]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 29]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 30]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 31]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayVisitor<[_; 32]> as serde::de::Visitor>::visit_seq::<_> |
1303 | | } |
1304 | | |
1305 | | impl<'a, 'de, T> Visitor<'de> for ArrayInPlaceVisitor<'a, [T; $len]> |
1306 | | where |
1307 | | T: Deserialize<'de>, |
1308 | | { |
1309 | | type Value = (); |
1310 | | |
1311 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1312 | 0 | formatter.write_str(concat!("an array of length ", $len)) |
1313 | 0 | } Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 1]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 2]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 3]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 4]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 5]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 6]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 7]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 8]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 9]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 10]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 11]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 12]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 13]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 14]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 15]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 16]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 17]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 18]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 19]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 20]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 21]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 22]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 23]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 24]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 25]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 26]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 27]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 28]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 29]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 30]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 31]> as serde::de::Visitor>::expecting Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 32]> as serde::de::Visitor>::expecting |
1314 | | |
1315 | | #[inline] |
1316 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
1317 | 0 | where |
1318 | 0 | A: SeqAccess<'de>, |
1319 | 0 | { |
1320 | 0 | let mut fail_idx = None; |
1321 | 0 | for (idx, dest) in self.0[..].iter_mut().enumerate() { |
1322 | 0 | if tri!(seq.next_element_seed(InPlaceSeed(dest))).is_none() { |
1323 | 0 | fail_idx = Some(idx); |
1324 | 0 | break; |
1325 | 0 | } |
1326 | | } |
1327 | 0 | if let Some(idx) = fail_idx { |
1328 | 0 | return Err(Error::invalid_length(idx, &self)); |
1329 | 0 | } |
1330 | 0 | Ok(()) |
1331 | 0 | } Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 1]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 2]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 3]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 4]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 5]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 6]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 7]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 8]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 9]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 10]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 11]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 12]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 13]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 14]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 15]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 16]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 17]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 18]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 19]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 20]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 21]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 22]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 23]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 24]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 25]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 26]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 27]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 28]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 29]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 30]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 31]> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <serde::de::impls::ArrayInPlaceVisitor<[_; 32]> as serde::de::Visitor>::visit_seq::<_> |
1332 | | } |
1333 | | |
1334 | | impl<'de, T> Deserialize<'de> for [T; $len] |
1335 | | where |
1336 | | T: Deserialize<'de>, |
1337 | | { |
1338 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1339 | 0 | where |
1340 | 0 | D: Deserializer<'de>, |
1341 | 0 | { |
1342 | 0 | deserializer.deserialize_tuple($len, ArrayVisitor::<[T; $len]>::new()) |
1343 | 0 | } Unexecuted instantiation: <[_; 1] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 2] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 3] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 4] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 5] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 6] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 7] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 8] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 9] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 10] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 11] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 12] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 13] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 14] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 15] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 16] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 17] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 18] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 19] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 20] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 21] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 22] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 23] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 24] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 25] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 26] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 27] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 28] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 29] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 30] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 31] as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <[_; 32] as serde::de::Deserialize>::deserialize::<_> |
1344 | | |
1345 | 0 | fn deserialize_in_place<D>(deserializer: D, place: &mut Self) -> Result<(), D::Error> |
1346 | 0 | where |
1347 | 0 | D: Deserializer<'de>, |
1348 | 0 | { |
1349 | 0 | deserializer.deserialize_tuple($len, ArrayInPlaceVisitor(place)) |
1350 | 0 | } Unexecuted instantiation: <[_; 1] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 2] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 3] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 4] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 5] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 6] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 7] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 8] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 9] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 10] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 11] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 12] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 13] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 14] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 15] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 16] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 17] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 18] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 19] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 20] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 21] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 22] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 23] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 24] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 25] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 26] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 27] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 28] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 29] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 30] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 31] as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <[_; 32] as serde::de::Deserialize>::deserialize_in_place::<_> |
1351 | | } |
1352 | | )+ |
1353 | | } |
1354 | | } |
1355 | | |
1356 | | array_impls! { |
1357 | | 1 => (0) |
1358 | | 2 => (0 1) |
1359 | | 3 => (0 1 2) |
1360 | | 4 => (0 1 2 3) |
1361 | | 5 => (0 1 2 3 4) |
1362 | | 6 => (0 1 2 3 4 5) |
1363 | | 7 => (0 1 2 3 4 5 6) |
1364 | | 8 => (0 1 2 3 4 5 6 7) |
1365 | | 9 => (0 1 2 3 4 5 6 7 8) |
1366 | | 10 => (0 1 2 3 4 5 6 7 8 9) |
1367 | | 11 => (0 1 2 3 4 5 6 7 8 9 10) |
1368 | | 12 => (0 1 2 3 4 5 6 7 8 9 10 11) |
1369 | | 13 => (0 1 2 3 4 5 6 7 8 9 10 11 12) |
1370 | | 14 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13) |
1371 | | 15 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14) |
1372 | | 16 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) |
1373 | | 17 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16) |
1374 | | 18 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17) |
1375 | | 19 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18) |
1376 | | 20 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) |
1377 | | 21 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20) |
1378 | | 22 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21) |
1379 | | 23 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22) |
1380 | | 24 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23) |
1381 | | 25 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24) |
1382 | | 26 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25) |
1383 | | 27 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26) |
1384 | | 28 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27) |
1385 | | 29 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28) |
1386 | | 30 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29) |
1387 | | 31 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30) |
1388 | | 32 => (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31) |
1389 | | } |
1390 | | |
1391 | | //////////////////////////////////////////////////////////////////////////////// |
1392 | | |
1393 | | macro_rules! tuple_impls { |
1394 | | ($($len:tt => ($($n:tt $name:ident)+))+) => { |
1395 | | $( |
1396 | | #[cfg_attr(docsrs, doc(hidden))] |
1397 | | impl<'de, $($name),+> Deserialize<'de> for ($($name,)+) |
1398 | | where |
1399 | | $($name: Deserialize<'de>,)+ |
1400 | | { |
1401 | | tuple_impl_body!($len => ($($n $name)+)); |
1402 | | } |
1403 | | )+ |
1404 | | }; |
1405 | | } |
1406 | | |
1407 | | macro_rules! tuple_impl_body { |
1408 | | ($len:tt => ($($n:tt $name:ident)+)) => { |
1409 | | #[inline] |
1410 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1411 | 0 | where |
1412 | 0 | D: Deserializer<'de>, |
1413 | 0 | { |
1414 | | struct TupleVisitor<$($name,)+> { |
1415 | | marker: PhantomData<($($name,)+)>, |
1416 | | } |
1417 | | |
1418 | | impl<'de, $($name: Deserialize<'de>),+> Visitor<'de> for TupleVisitor<$($name,)+> { |
1419 | | type Value = ($($name,)+); |
1420 | | |
1421 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1422 | 0 | formatter.write_str(concat!("a tuple of size ", $len)) |
1423 | 0 | } Unexecuted instantiation: <<(_,) as serde::de::Deserialize>::deserialize::TupleVisitor<_> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting |
1424 | | |
1425 | | #[inline] |
1426 | | #[allow(non_snake_case)] |
1427 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
1428 | 0 | where |
1429 | 0 | A: SeqAccess<'de>, |
1430 | 0 | { |
1431 | | $( |
1432 | 0 | let $name = match tri!(seq.next_element()) { |
1433 | 0 | Some(value) => value, |
1434 | 0 | None => return Err(Error::invalid_length($n, &self)), |
1435 | | }; |
1436 | | )+ |
1437 | | |
1438 | 0 | Ok(($($name,)+)) |
1439 | 0 | } Unexecuted instantiation: <<(_,) as serde::de::Deserialize>::deserialize::TupleVisitor<_> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::TupleVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> |
1440 | | } |
1441 | | |
1442 | 0 | deserializer.deserialize_tuple($len, TupleVisitor { marker: PhantomData }) |
1443 | 0 | } Unexecuted instantiation: <(_,) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize::<_> |
1444 | | |
1445 | | #[inline] |
1446 | 0 | fn deserialize_in_place<D>(deserializer: D, place: &mut Self) -> Result<(), D::Error> |
1447 | 0 | where |
1448 | 0 | D: Deserializer<'de>, |
1449 | 0 | { |
1450 | | struct TupleInPlaceVisitor<'a, $($name: 'a,)+>(&'a mut ($($name,)+)); |
1451 | | |
1452 | | impl<'a, 'de, $($name: Deserialize<'de>),+> Visitor<'de> for TupleInPlaceVisitor<'a, $($name,)+> { |
1453 | | type Value = (); |
1454 | | |
1455 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1456 | 0 | formatter.write_str(concat!("a tuple of size ", $len)) |
1457 | 0 | } Unexecuted instantiation: <<(_,) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::expecting |
1458 | | |
1459 | | #[inline] |
1460 | | #[allow(non_snake_case)] |
1461 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
1462 | 0 | where |
1463 | 0 | A: SeqAccess<'de>, |
1464 | 0 | { |
1465 | | $( |
1466 | 0 | if tri!(seq.next_element_seed(InPlaceSeed(&mut (self.0).$n))).is_none() { |
1467 | 0 | return Err(Error::invalid_length($n, &self)); |
1468 | 0 | } |
1469 | 0 | )+ |
1470 | 0 |
|
1471 | 0 | Ok(()) |
1472 | 0 | } Unexecuted instantiation: <<(_,) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> Unexecuted instantiation: <<(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::TupleInPlaceVisitor<_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _> as serde::de::Visitor>::visit_seq::<_> |
1473 | | } |
1474 | | |
1475 | 0 | deserializer.deserialize_tuple($len, TupleInPlaceVisitor(place)) |
1476 | 0 | } Unexecuted instantiation: <(_,) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> Unexecuted instantiation: <(_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _) as serde::de::Deserialize>::deserialize_in_place::<_> |
1477 | | }; |
1478 | | } |
1479 | | |
1480 | | #[cfg_attr(docsrs, doc(fake_variadic))] |
1481 | | #[cfg_attr( |
1482 | | docsrs, |
1483 | | doc = "This trait is implemented for tuples up to 16 items long." |
1484 | | )] |
1485 | | impl<'de, T> Deserialize<'de> for (T,) |
1486 | | where |
1487 | | T: Deserialize<'de>, |
1488 | | { |
1489 | | tuple_impl_body!(1 => (0 T)); |
1490 | | } |
1491 | | |
1492 | | tuple_impls! { |
1493 | | 2 => (0 T0 1 T1) |
1494 | | 3 => (0 T0 1 T1 2 T2) |
1495 | | 4 => (0 T0 1 T1 2 T2 3 T3) |
1496 | | 5 => (0 T0 1 T1 2 T2 3 T3 4 T4) |
1497 | | 6 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5) |
1498 | | 7 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6) |
1499 | | 8 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7) |
1500 | | 9 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8) |
1501 | | 10 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9) |
1502 | | 11 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10) |
1503 | | 12 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11) |
1504 | | 13 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12) |
1505 | | 14 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13) |
1506 | | 15 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14) |
1507 | | 16 => (0 T0 1 T1 2 T2 3 T3 4 T4 5 T5 6 T6 7 T7 8 T8 9 T9 10 T10 11 T11 12 T12 13 T13 14 T14 15 T15) |
1508 | | } |
1509 | | |
1510 | | //////////////////////////////////////////////////////////////////////////////// |
1511 | | |
1512 | | macro_rules! map_impl { |
1513 | | ( |
1514 | | $(#[$attr:meta])* |
1515 | | $ty:ident <K $(: $kbound1:ident $(+ $kbound2:ident)*)*, V $(, $typaram:ident : $bound1:ident $(+ $bound2:ident)*)*>, |
1516 | | $access:ident, |
1517 | | $with_capacity:expr, |
1518 | | ) => { |
1519 | | $(#[$attr])* |
1520 | | impl<'de, K, V $(, $typaram)*> Deserialize<'de> for $ty<K, V $(, $typaram)*> |
1521 | | where |
1522 | | K: Deserialize<'de> $(+ $kbound1 $(+ $kbound2)*)*, |
1523 | | V: Deserialize<'de>, |
1524 | | $($typaram: $bound1 $(+ $bound2)*),* |
1525 | | { |
1526 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1527 | 0 | where |
1528 | 0 | D: Deserializer<'de>, |
1529 | 0 | { |
1530 | | struct MapVisitor<K, V $(, $typaram)*> { |
1531 | | marker: PhantomData<$ty<K, V $(, $typaram)*>>, |
1532 | | } |
1533 | | |
1534 | | impl<'de, K, V $(, $typaram)*> Visitor<'de> for MapVisitor<K, V $(, $typaram)*> |
1535 | | where |
1536 | | K: Deserialize<'de> $(+ $kbound1 $(+ $kbound2)*)*, |
1537 | | V: Deserialize<'de>, |
1538 | | $($typaram: $bound1 $(+ $bound2)*),* |
1539 | | { |
1540 | | type Value = $ty<K, V $(, $typaram)*>; |
1541 | | |
1542 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1543 | 0 | formatter.write_str("a map") |
1544 | 0 | } Unexecuted instantiation: <<alloc::collections::btree::map::BTreeMap<_, _> as serde::de::Deserialize>::deserialize::MapVisitor<_, _> as serde::de::Visitor>::expecting Unexecuted instantiation: <<std::collections::hash::map::HashMap<_, _, _> as serde::de::Deserialize>::deserialize::MapVisitor<_, _, _> as serde::de::Visitor>::expecting |
1545 | | |
1546 | | #[inline] |
1547 | 0 | fn visit_map<A>(self, mut $access: A) -> Result<Self::Value, A::Error> |
1548 | 0 | where |
1549 | 0 | A: MapAccess<'de>, |
1550 | 0 | { |
1551 | 0 | let mut values = $with_capacity; |
1552 | | |
1553 | 0 | while let Some((key, value)) = tri!($access.next_entry()) { |
1554 | 0 | values.insert(key, value); |
1555 | 0 | } |
1556 | | |
1557 | 0 | Ok(values) |
1558 | 0 | } Unexecuted instantiation: <<alloc::collections::btree::map::BTreeMap<_, _> as serde::de::Deserialize>::deserialize::MapVisitor<_, _> as serde::de::Visitor>::visit_map::<_> Unexecuted instantiation: <<std::collections::hash::map::HashMap<_, _, _> as serde::de::Deserialize>::deserialize::MapVisitor<_, _, _> as serde::de::Visitor>::visit_map::<_> |
1559 | | } |
1560 | | |
1561 | 0 | let visitor = MapVisitor { marker: PhantomData }; |
1562 | 0 | deserializer.deserialize_map(visitor) |
1563 | 0 | } Unexecuted instantiation: <alloc::collections::btree::map::BTreeMap<_, _> as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <std::collections::hash::map::HashMap<_, _, _> as serde::de::Deserialize>::deserialize::<_> |
1564 | | } |
1565 | | } |
1566 | | } |
1567 | | |
1568 | | map_impl! { |
1569 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1570 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1571 | | BTreeMap<K: Ord, V>, |
1572 | | map, |
1573 | | BTreeMap::new(), |
1574 | | } |
1575 | | |
1576 | | map_impl! { |
1577 | | #[cfg(feature = "std")] |
1578 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] |
1579 | | HashMap<K: Eq + Hash, V, S: BuildHasher + Default>, |
1580 | | map, |
1581 | | HashMap::with_capacity_and_hasher(size_hint::cautious::<(K, V)>(map.size_hint()), S::default()), |
1582 | | } |
1583 | | |
1584 | | //////////////////////////////////////////////////////////////////////////////// |
1585 | | |
1586 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1587 | | macro_rules! parse_ip_impl { |
1588 | | ($ty:ty, $expecting:expr, $size:tt) => { |
1589 | | impl<'de> Deserialize<'de> for $ty { |
1590 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1591 | 0 | where |
1592 | 0 | D: Deserializer<'de>, |
1593 | 0 | { |
1594 | 0 | if deserializer.is_human_readable() { |
1595 | 0 | deserializer.deserialize_str(FromStrVisitor::new($expecting)) |
1596 | | } else { |
1597 | 0 | <[u8; $size]>::deserialize(deserializer).map(<$ty>::from) |
1598 | | } |
1599 | 0 | } Unexecuted instantiation: <core::net::ip_addr::Ipv4Addr as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::net::ip_addr::Ipv6Addr as serde::de::Deserialize>::deserialize::<_> |
1600 | | } |
1601 | | }; |
1602 | | } |
1603 | | |
1604 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1605 | | macro_rules! variant_identifier { |
1606 | | ( |
1607 | | $name_kind:ident ($($variant:ident; $bytes:expr; $index:expr),*) |
1608 | | $expecting_message:expr, |
1609 | | $variants_name:ident |
1610 | | ) => { |
1611 | | enum $name_kind { |
1612 | | $($variant),* |
1613 | | } |
1614 | | |
1615 | | static $variants_name: &[&str] = &[$(stringify!($variant)),*]; |
1616 | | |
1617 | | impl<'de> Deserialize<'de> for $name_kind { |
1618 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1619 | 0 | where |
1620 | 0 | D: Deserializer<'de>, |
1621 | 0 | { |
1622 | | struct KindVisitor; |
1623 | | |
1624 | | impl<'de> Visitor<'de> for KindVisitor { |
1625 | | type Value = $name_kind; |
1626 | | |
1627 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1628 | 0 | formatter.write_str($expecting_message) |
1629 | 0 | } Unexecuted instantiation: <<<core::net::ip_addr::IpAddr as serde::de::Deserialize>::deserialize::IpAddrKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<<core::net::socket_addr::SocketAddr as serde::de::Deserialize>::deserialize::SocketAddrKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<serde::de::impls::OsStringKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::expecting |
1630 | | |
1631 | 0 | fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E> |
1632 | 0 | where |
1633 | 0 | E: Error, |
1634 | 0 | { |
1635 | 0 | match value { |
1636 | | $( |
1637 | 0 | $index => Ok($name_kind :: $variant), |
1638 | | )* |
1639 | 0 | _ => Err(Error::invalid_value(Unexpected::Unsigned(value), &self),), |
1640 | | } |
1641 | 0 | } Unexecuted instantiation: <<<core::net::ip_addr::IpAddr as serde::de::Deserialize>::deserialize::IpAddrKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<<core::net::socket_addr::SocketAddr as serde::de::Deserialize>::deserialize::SocketAddrKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::visit_u64::<_> Unexecuted instantiation: <<serde::de::impls::OsStringKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::visit_u64::<_> |
1642 | | |
1643 | 0 | fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> |
1644 | 0 | where |
1645 | 0 | E: Error, |
1646 | 0 | { |
1647 | 0 | match value { |
1648 | 0 | $( |
1649 | 0 | stringify!($variant) => Ok($name_kind :: $variant), |
1650 | | )* |
1651 | 0 | _ => Err(Error::unknown_variant(value, $variants_name)), |
1652 | | } |
1653 | 0 | } Unexecuted instantiation: <<<core::net::ip_addr::IpAddr as serde::de::Deserialize>::deserialize::IpAddrKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::visit_str::<_> Unexecuted instantiation: <<<core::net::socket_addr::SocketAddr as serde::de::Deserialize>::deserialize::SocketAddrKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::visit_str::<_> Unexecuted instantiation: <<serde::de::impls::OsStringKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::visit_str::<_> |
1654 | | |
1655 | 0 | fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E> |
1656 | 0 | where |
1657 | 0 | E: Error, |
1658 | 0 | { |
1659 | 0 | match value { |
1660 | | $( |
1661 | 0 | $bytes => Ok($name_kind :: $variant), |
1662 | | )* |
1663 | | _ => { |
1664 | 0 | match str::from_utf8(value) { |
1665 | 0 | Ok(value) => Err(Error::unknown_variant(value, $variants_name)), |
1666 | 0 | Err(_) => Err(Error::invalid_value(Unexpected::Bytes(value), &self)), |
1667 | | } |
1668 | | } |
1669 | | } |
1670 | 0 | } Unexecuted instantiation: <<<core::net::ip_addr::IpAddr as serde::de::Deserialize>::deserialize::IpAddrKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::visit_bytes::<_> Unexecuted instantiation: <<<core::net::socket_addr::SocketAddr as serde::de::Deserialize>::deserialize::SocketAddrKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::visit_bytes::<_> Unexecuted instantiation: <<serde::de::impls::OsStringKind as serde::de::Deserialize>::deserialize::KindVisitor as serde::de::Visitor>::visit_bytes::<_> |
1671 | | } |
1672 | | |
1673 | 0 | deserializer.deserialize_identifier(KindVisitor) |
1674 | 0 | } Unexecuted instantiation: <<core::net::ip_addr::IpAddr as serde::de::Deserialize>::deserialize::IpAddrKind as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <<core::net::socket_addr::SocketAddr as serde::de::Deserialize>::deserialize::SocketAddrKind as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <serde::de::impls::OsStringKind as serde::de::Deserialize>::deserialize::<_> |
1675 | | } |
1676 | | } |
1677 | | } |
1678 | | |
1679 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1680 | | macro_rules! deserialize_enum { |
1681 | | ( |
1682 | | $name:ident $name_kind:ident ($($variant:ident; $bytes:expr; $index:expr),*) |
1683 | | $expecting_message:expr, |
1684 | | $deserializer:expr |
1685 | | ) => { |
1686 | | variant_identifier! { |
1687 | | $name_kind ($($variant; $bytes; $index),*) |
1688 | | $expecting_message, |
1689 | | VARIANTS |
1690 | | } |
1691 | | |
1692 | | struct EnumVisitor; |
1693 | | impl<'de> Visitor<'de> for EnumVisitor { |
1694 | | type Value = $name; |
1695 | | |
1696 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1697 | 0 | formatter.write_str(concat!("a ", stringify!($name))) |
1698 | 0 | } Unexecuted instantiation: <<core::net::ip_addr::IpAddr as serde::de::Deserialize>::deserialize::EnumVisitor as serde::de::Visitor>::expecting Unexecuted instantiation: <<core::net::socket_addr::SocketAddr as serde::de::Deserialize>::deserialize::EnumVisitor as serde::de::Visitor>::expecting |
1699 | | |
1700 | | |
1701 | 0 | fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error> |
1702 | 0 | where |
1703 | 0 | A: EnumAccess<'de>, |
1704 | 0 | { |
1705 | 0 | match tri!(data.variant()) { |
1706 | | $( |
1707 | 0 | ($name_kind :: $variant, v) => v.newtype_variant().map($name :: $variant), |
1708 | | )* |
1709 | | } |
1710 | 0 | } Unexecuted instantiation: <<core::net::ip_addr::IpAddr as serde::de::Deserialize>::deserialize::EnumVisitor as serde::de::Visitor>::visit_enum::<_> Unexecuted instantiation: <<core::net::socket_addr::SocketAddr as serde::de::Deserialize>::deserialize::EnumVisitor as serde::de::Visitor>::visit_enum::<_> |
1711 | | } |
1712 | | $deserializer.deserialize_enum(stringify!($name), VARIANTS, EnumVisitor) |
1713 | | } |
1714 | | } |
1715 | | |
1716 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1717 | | impl<'de> Deserialize<'de> for net::IpAddr { |
1718 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1719 | 0 | where |
1720 | 0 | D: Deserializer<'de>, |
1721 | 0 | { |
1722 | 0 | if deserializer.is_human_readable() { |
1723 | 0 | deserializer.deserialize_str(FromStrVisitor::new("IP address")) |
1724 | | } else { |
1725 | | use crate::lib::net::IpAddr; |
1726 | 0 | deserialize_enum! { |
1727 | 0 | IpAddr IpAddrKind (V4; b"V4"; 0, V6; b"V6"; 1) |
1728 | 0 | "`V4` or `V6`", |
1729 | 0 | deserializer |
1730 | 0 | } |
1731 | | } |
1732 | 0 | } |
1733 | | } |
1734 | | |
1735 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1736 | | parse_ip_impl!(net::Ipv4Addr, "IPv4 address", 4); |
1737 | | |
1738 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1739 | | parse_ip_impl!(net::Ipv6Addr, "IPv6 address", 16); |
1740 | | |
1741 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1742 | | macro_rules! parse_socket_impl { |
1743 | | ( |
1744 | | $ty:ty, $expecting:tt, |
1745 | | $new:expr, |
1746 | | ) => { |
1747 | | impl<'de> Deserialize<'de> for $ty { |
1748 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1749 | 0 | where |
1750 | 0 | D: Deserializer<'de>, |
1751 | 0 | { |
1752 | 0 | if deserializer.is_human_readable() { |
1753 | 0 | deserializer.deserialize_str(FromStrVisitor::new($expecting)) |
1754 | | } else { |
1755 | 0 | <(_, u16)>::deserialize(deserializer).map($new) |
1756 | | } |
1757 | 0 | } Unexecuted instantiation: <core::net::socket_addr::SocketAddrV4 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::net::socket_addr::SocketAddrV6 as serde::de::Deserialize>::deserialize::<_> |
1758 | | } |
1759 | | }; |
1760 | | } |
1761 | | |
1762 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1763 | | impl<'de> Deserialize<'de> for net::SocketAddr { |
1764 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1765 | 0 | where |
1766 | 0 | D: Deserializer<'de>, |
1767 | 0 | { |
1768 | 0 | if deserializer.is_human_readable() { |
1769 | 0 | deserializer.deserialize_str(FromStrVisitor::new("socket address")) |
1770 | | } else { |
1771 | | use crate::lib::net::SocketAddr; |
1772 | 0 | deserialize_enum! { |
1773 | 0 | SocketAddr SocketAddrKind (V4; b"V4"; 0, V6; b"V6"; 1) |
1774 | 0 | "`V4` or `V6`", |
1775 | 0 | deserializer |
1776 | 0 | } |
1777 | | } |
1778 | 0 | } |
1779 | | } |
1780 | | |
1781 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1782 | | parse_socket_impl! { |
1783 | | net::SocketAddrV4, "IPv4 socket address", |
1784 | 0 | |(ip, port)| net::SocketAddrV4::new(ip, port), |
1785 | | } |
1786 | | |
1787 | | #[cfg(any(feature = "std", not(no_core_net)))] |
1788 | | parse_socket_impl! { |
1789 | | net::SocketAddrV6, "IPv6 socket address", |
1790 | 0 | |(ip, port)| net::SocketAddrV6::new(ip, port, 0, 0), |
1791 | | } |
1792 | | |
1793 | | //////////////////////////////////////////////////////////////////////////////// |
1794 | | |
1795 | | #[cfg(feature = "std")] |
1796 | | struct PathVisitor; |
1797 | | |
1798 | | #[cfg(feature = "std")] |
1799 | | impl<'a> Visitor<'a> for PathVisitor { |
1800 | | type Value = &'a Path; |
1801 | | |
1802 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1803 | 0 | formatter.write_str("a borrowed path") |
1804 | 0 | } |
1805 | | |
1806 | 0 | fn visit_borrowed_str<E>(self, v: &'a str) -> Result<Self::Value, E> |
1807 | 0 | where |
1808 | 0 | E: Error, |
1809 | 0 | { |
1810 | 0 | Ok(v.as_ref()) |
1811 | 0 | } |
1812 | | |
1813 | 0 | fn visit_borrowed_bytes<E>(self, v: &'a [u8]) -> Result<Self::Value, E> |
1814 | 0 | where |
1815 | 0 | E: Error, |
1816 | 0 | { |
1817 | 0 | str::from_utf8(v) |
1818 | 0 | .map(AsRef::as_ref) |
1819 | 0 | .map_err(|_| Error::invalid_value(Unexpected::Bytes(v), &self)) |
1820 | 0 | } |
1821 | | } |
1822 | | |
1823 | | #[cfg(feature = "std")] |
1824 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] |
1825 | | impl<'de: 'a, 'a> Deserialize<'de> for &'a Path { |
1826 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1827 | 0 | where |
1828 | 0 | D: Deserializer<'de>, |
1829 | 0 | { |
1830 | 0 | deserializer.deserialize_str(PathVisitor) |
1831 | 0 | } |
1832 | | } |
1833 | | |
1834 | | #[cfg(feature = "std")] |
1835 | | struct PathBufVisitor; |
1836 | | |
1837 | | #[cfg(feature = "std")] |
1838 | | impl<'de> Visitor<'de> for PathBufVisitor { |
1839 | | type Value = PathBuf; |
1840 | | |
1841 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1842 | 0 | formatter.write_str("path string") |
1843 | 0 | } |
1844 | | |
1845 | 0 | fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> |
1846 | 0 | where |
1847 | 0 | E: Error, |
1848 | 0 | { |
1849 | 0 | Ok(From::from(v)) |
1850 | 0 | } |
1851 | | |
1852 | 0 | fn visit_string<E>(self, v: String) -> Result<Self::Value, E> |
1853 | 0 | where |
1854 | 0 | E: Error, |
1855 | 0 | { |
1856 | 0 | Ok(From::from(v)) |
1857 | 0 | } |
1858 | | |
1859 | 0 | fn visit_bytes<E>(self, v: &[u8]) -> Result<Self::Value, E> |
1860 | 0 | where |
1861 | 0 | E: Error, |
1862 | 0 | { |
1863 | 0 | str::from_utf8(v) |
1864 | 0 | .map(From::from) |
1865 | 0 | .map_err(|_| Error::invalid_value(Unexpected::Bytes(v), &self)) |
1866 | 0 | } |
1867 | | |
1868 | 0 | fn visit_byte_buf<E>(self, v: Vec<u8>) -> Result<Self::Value, E> |
1869 | 0 | where |
1870 | 0 | E: Error, |
1871 | 0 | { |
1872 | 0 | String::from_utf8(v) |
1873 | 0 | .map(From::from) |
1874 | 0 | .map_err(|e| Error::invalid_value(Unexpected::Bytes(&e.into_bytes()), &self)) |
1875 | 0 | } |
1876 | | } |
1877 | | |
1878 | | #[cfg(feature = "std")] |
1879 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] |
1880 | | impl<'de> Deserialize<'de> for PathBuf { |
1881 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1882 | 0 | where |
1883 | 0 | D: Deserializer<'de>, |
1884 | 0 | { |
1885 | 0 | deserializer.deserialize_string(PathBufVisitor) |
1886 | 0 | } |
1887 | | } |
1888 | | |
1889 | | forwarded_impl! { |
1890 | | #[cfg(feature = "std")] |
1891 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] |
1892 | | (), Box<Path>, PathBuf::into_boxed_path |
1893 | | } |
1894 | | |
1895 | | //////////////////////////////////////////////////////////////////////////////// |
1896 | | |
1897 | | // If this were outside of the serde crate, it would just use: |
1898 | | // |
1899 | | // #[derive(Deserialize)] |
1900 | | // #[serde(variant_identifier)] |
1901 | | #[cfg(all(feature = "std", any(unix, windows)))] |
1902 | | variant_identifier! { |
1903 | | OsStringKind (Unix; b"Unix"; 0, Windows; b"Windows"; 1) |
1904 | | "`Unix` or `Windows`", |
1905 | | OSSTR_VARIANTS |
1906 | | } |
1907 | | |
1908 | | #[cfg(all(feature = "std", any(unix, windows)))] |
1909 | | struct OsStringVisitor; |
1910 | | |
1911 | | #[cfg(all(feature = "std", any(unix, windows)))] |
1912 | | impl<'de> Visitor<'de> for OsStringVisitor { |
1913 | | type Value = OsString; |
1914 | | |
1915 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
1916 | 0 | formatter.write_str("os string") |
1917 | 0 | } |
1918 | | |
1919 | | #[cfg(unix)] |
1920 | 0 | fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error> |
1921 | 0 | where |
1922 | 0 | A: EnumAccess<'de>, |
1923 | 0 | { |
1924 | | use std::os::unix::ffi::OsStringExt; |
1925 | | |
1926 | 0 | match tri!(data.variant()) { |
1927 | 0 | (OsStringKind::Unix, v) => v.newtype_variant().map(OsString::from_vec), |
1928 | 0 | (OsStringKind::Windows, _) => Err(Error::custom( |
1929 | 0 | "cannot deserialize Windows OS string on Unix", |
1930 | 0 | )), |
1931 | | } |
1932 | 0 | } |
1933 | | |
1934 | | #[cfg(windows)] |
1935 | | fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error> |
1936 | | where |
1937 | | A: EnumAccess<'de>, |
1938 | | { |
1939 | | use std::os::windows::ffi::OsStringExt; |
1940 | | |
1941 | | match tri!(data.variant()) { |
1942 | | (OsStringKind::Windows, v) => v |
1943 | | .newtype_variant::<Vec<u16>>() |
1944 | | .map(|vec| OsString::from_wide(&vec)), |
1945 | | (OsStringKind::Unix, _) => Err(Error::custom( |
1946 | | "cannot deserialize Unix OS string on Windows", |
1947 | | )), |
1948 | | } |
1949 | | } |
1950 | | } |
1951 | | |
1952 | | #[cfg(all(feature = "std", any(unix, windows)))] |
1953 | | #[cfg_attr(docsrs, doc(cfg(all(feature = "std", any(unix, windows)))))] |
1954 | | impl<'de> Deserialize<'de> for OsString { |
1955 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1956 | 0 | where |
1957 | 0 | D: Deserializer<'de>, |
1958 | 0 | { |
1959 | 0 | deserializer.deserialize_enum("OsString", OSSTR_VARIANTS, OsStringVisitor) |
1960 | 0 | } |
1961 | | } |
1962 | | |
1963 | | //////////////////////////////////////////////////////////////////////////////// |
1964 | | |
1965 | | forwarded_impl! { |
1966 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1967 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1968 | | (T), Box<T>, Box::new |
1969 | | } |
1970 | | |
1971 | | forwarded_impl! { |
1972 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1973 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1974 | | (T), Box<[T]>, Vec::into_boxed_slice |
1975 | | } |
1976 | | |
1977 | | forwarded_impl! { |
1978 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1979 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1980 | | (), Box<str>, String::into_boxed_str |
1981 | | } |
1982 | | |
1983 | | forwarded_impl! { |
1984 | | #[cfg(all(feature = "std", any(unix, windows)))] |
1985 | | #[cfg_attr(docsrs, doc(cfg(all(feature = "std", any(unix, windows)))))] |
1986 | | (), Box<OsStr>, OsString::into_boxed_os_str |
1987 | | } |
1988 | | |
1989 | | #[cfg(any(feature = "std", feature = "alloc"))] |
1990 | | #[cfg_attr(docsrs, doc(cfg(any(feature = "std", feature = "alloc"))))] |
1991 | | impl<'de, 'a, T> Deserialize<'de> for Cow<'a, T> |
1992 | | where |
1993 | | T: ?Sized + ToOwned, |
1994 | | T::Owned: Deserialize<'de>, |
1995 | | { |
1996 | | #[inline] |
1997 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
1998 | 0 | where |
1999 | 0 | D: Deserializer<'de>, |
2000 | 0 | { |
2001 | 0 | T::Owned::deserialize(deserializer).map(Cow::Owned) |
2002 | 0 | } |
2003 | | } |
2004 | | |
2005 | | //////////////////////////////////////////////////////////////////////////////// |
2006 | | |
2007 | | /// This impl requires the [`"rc"`] Cargo feature of Serde. The resulting |
2008 | | /// `Weak<T>` has a reference count of 0 and cannot be upgraded. |
2009 | | /// |
2010 | | /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc |
2011 | | #[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] |
2012 | | #[cfg_attr( |
2013 | | docsrs, |
2014 | | doc(cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))) |
2015 | | )] |
2016 | | impl<'de, T> Deserialize<'de> for RcWeak<T> |
2017 | | where |
2018 | | T: Deserialize<'de>, |
2019 | | { |
2020 | | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2021 | | where |
2022 | | D: Deserializer<'de>, |
2023 | | { |
2024 | | tri!(Option::<T>::deserialize(deserializer)); |
2025 | | Ok(RcWeak::new()) |
2026 | | } |
2027 | | } |
2028 | | |
2029 | | /// This impl requires the [`"rc"`] Cargo feature of Serde. The resulting |
2030 | | /// `Weak<T>` has a reference count of 0 and cannot be upgraded. |
2031 | | /// |
2032 | | /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc |
2033 | | #[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] |
2034 | | #[cfg_attr( |
2035 | | docsrs, |
2036 | | doc(cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))) |
2037 | | )] |
2038 | | impl<'de, T> Deserialize<'de> for ArcWeak<T> |
2039 | | where |
2040 | | T: Deserialize<'de>, |
2041 | | { |
2042 | | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2043 | | where |
2044 | | D: Deserializer<'de>, |
2045 | | { |
2046 | | tri!(Option::<T>::deserialize(deserializer)); |
2047 | | Ok(ArcWeak::new()) |
2048 | | } |
2049 | | } |
2050 | | |
2051 | | //////////////////////////////////////////////////////////////////////////////// |
2052 | | |
2053 | | macro_rules! box_forwarded_impl { |
2054 | | ( |
2055 | | $(#[$attr:meta])* |
2056 | | $t:ident |
2057 | | ) => { |
2058 | | $(#[$attr])* |
2059 | | impl<'de, T> Deserialize<'de> for $t<T> |
2060 | | where |
2061 | | T: ?Sized, |
2062 | | Box<T>: Deserialize<'de>, |
2063 | | { |
2064 | | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2065 | | where |
2066 | | D: Deserializer<'de>, |
2067 | | { |
2068 | | Box::deserialize(deserializer).map(Into::into) |
2069 | | } |
2070 | | } |
2071 | | }; |
2072 | | } |
2073 | | |
2074 | | box_forwarded_impl! { |
2075 | | /// This impl requires the [`"rc"`] Cargo feature of Serde. |
2076 | | /// |
2077 | | /// Deserializing a data structure containing `Rc` will not attempt to |
2078 | | /// deduplicate `Rc` references to the same data. Every deserialized `Rc` |
2079 | | /// will end up with a strong count of 1. |
2080 | | /// |
2081 | | /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc |
2082 | | #[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] |
2083 | | #[cfg_attr(docsrs, doc(cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))))] |
2084 | | Rc |
2085 | | } |
2086 | | |
2087 | | box_forwarded_impl! { |
2088 | | /// This impl requires the [`"rc"`] Cargo feature of Serde. |
2089 | | /// |
2090 | | /// Deserializing a data structure containing `Arc` will not attempt to |
2091 | | /// deduplicate `Arc` references to the same data. Every deserialized `Arc` |
2092 | | /// will end up with a strong count of 1. |
2093 | | /// |
2094 | | /// [`"rc"`]: https://serde.rs/feature-flags.html#-features-rc |
2095 | | #[cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))] |
2096 | | #[cfg_attr(docsrs, doc(cfg(all(feature = "rc", any(feature = "std", feature = "alloc")))))] |
2097 | | Arc |
2098 | | } |
2099 | | |
2100 | | //////////////////////////////////////////////////////////////////////////////// |
2101 | | |
2102 | | impl<'de, T> Deserialize<'de> for Cell<T> |
2103 | | where |
2104 | | T: Deserialize<'de> + Copy, |
2105 | | { |
2106 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2107 | 0 | where |
2108 | 0 | D: Deserializer<'de>, |
2109 | 0 | { |
2110 | 0 | T::deserialize(deserializer).map(Cell::new) |
2111 | 0 | } |
2112 | | } |
2113 | | |
2114 | | forwarded_impl! { |
2115 | | (T), RefCell<T>, RefCell::new |
2116 | | } |
2117 | | |
2118 | | forwarded_impl! { |
2119 | | #[cfg(feature = "std")] |
2120 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] |
2121 | | (T), Mutex<T>, Mutex::new |
2122 | | } |
2123 | | |
2124 | | forwarded_impl! { |
2125 | | #[cfg(feature = "std")] |
2126 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] |
2127 | | (T), RwLock<T>, RwLock::new |
2128 | | } |
2129 | | |
2130 | | //////////////////////////////////////////////////////////////////////////////// |
2131 | | |
2132 | | // This is a cleaned-up version of the impl generated by: |
2133 | | // |
2134 | | // #[derive(Deserialize)] |
2135 | | // #[serde(deny_unknown_fields)] |
2136 | | // struct Duration { |
2137 | | // secs: u64, |
2138 | | // nanos: u32, |
2139 | | // } |
2140 | | impl<'de> Deserialize<'de> for Duration { |
2141 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2142 | 0 | where |
2143 | 0 | D: Deserializer<'de>, |
2144 | 0 | { |
2145 | | // If this were outside of the serde crate, it would just use: |
2146 | | // |
2147 | | // #[derive(Deserialize)] |
2148 | | // #[serde(field_identifier, rename_all = "lowercase")] |
2149 | | enum Field { |
2150 | | Secs, |
2151 | | Nanos, |
2152 | | } |
2153 | | |
2154 | | impl<'de> Deserialize<'de> for Field { |
2155 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2156 | 0 | where |
2157 | 0 | D: Deserializer<'de>, |
2158 | 0 | { |
2159 | | struct FieldVisitor; |
2160 | | |
2161 | | impl<'de> Visitor<'de> for FieldVisitor { |
2162 | | type Value = Field; |
2163 | | |
2164 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2165 | 0 | formatter.write_str("`secs` or `nanos`") |
2166 | 0 | } |
2167 | | |
2168 | 0 | fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> |
2169 | 0 | where |
2170 | 0 | E: Error, |
2171 | 0 | { |
2172 | 0 | match value { |
2173 | 0 | "secs" => Ok(Field::Secs), |
2174 | 0 | "nanos" => Ok(Field::Nanos), |
2175 | 0 | _ => Err(Error::unknown_field(value, FIELDS)), |
2176 | | } |
2177 | 0 | } |
2178 | | |
2179 | 0 | fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E> |
2180 | 0 | where |
2181 | 0 | E: Error, |
2182 | 0 | { |
2183 | 0 | match value { |
2184 | 0 | b"secs" => Ok(Field::Secs), |
2185 | 0 | b"nanos" => Ok(Field::Nanos), |
2186 | | _ => { |
2187 | 0 | let value = crate::__private::from_utf8_lossy(value); |
2188 | 0 | Err(Error::unknown_field(&*value, FIELDS)) |
2189 | | } |
2190 | | } |
2191 | 0 | } |
2192 | | } |
2193 | | |
2194 | 0 | deserializer.deserialize_identifier(FieldVisitor) |
2195 | 0 | } |
2196 | | } |
2197 | | |
2198 | 0 | fn check_overflow<E>(secs: u64, nanos: u32) -> Result<(), E> |
2199 | 0 | where |
2200 | 0 | E: Error, |
2201 | 0 | { |
2202 | | static NANOS_PER_SEC: u32 = 1_000_000_000; |
2203 | 0 | match secs.checked_add((nanos / NANOS_PER_SEC) as u64) { |
2204 | 0 | Some(_) => Ok(()), |
2205 | 0 | None => Err(E::custom("overflow deserializing Duration")), |
2206 | | } |
2207 | 0 | } |
2208 | | |
2209 | | struct DurationVisitor; |
2210 | | |
2211 | | impl<'de> Visitor<'de> for DurationVisitor { |
2212 | | type Value = Duration; |
2213 | | |
2214 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2215 | 0 | formatter.write_str("struct Duration") |
2216 | 0 | } |
2217 | | |
2218 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
2219 | 0 | where |
2220 | 0 | A: SeqAccess<'de>, |
2221 | 0 | { |
2222 | 0 | let secs: u64 = match tri!(seq.next_element()) { |
2223 | 0 | Some(value) => value, |
2224 | | None => { |
2225 | 0 | return Err(Error::invalid_length(0, &self)); |
2226 | | } |
2227 | | }; |
2228 | 0 | let nanos: u32 = match tri!(seq.next_element()) { |
2229 | 0 | Some(value) => value, |
2230 | | None => { |
2231 | 0 | return Err(Error::invalid_length(1, &self)); |
2232 | | } |
2233 | | }; |
2234 | 0 | tri!(check_overflow(secs, nanos)); |
2235 | 0 | Ok(Duration::new(secs, nanos)) |
2236 | 0 | } |
2237 | | |
2238 | 0 | fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> |
2239 | 0 | where |
2240 | 0 | A: MapAccess<'de>, |
2241 | 0 | { |
2242 | 0 | let mut secs: Option<u64> = None; |
2243 | 0 | let mut nanos: Option<u32> = None; |
2244 | 0 | while let Some(key) = tri!(map.next_key()) { |
2245 | 0 | match key { |
2246 | | Field::Secs => { |
2247 | 0 | if secs.is_some() { |
2248 | 0 | return Err(<A::Error as Error>::duplicate_field("secs")); |
2249 | 0 | } |
2250 | 0 | secs = Some(tri!(map.next_value())); |
2251 | | } |
2252 | | Field::Nanos => { |
2253 | 0 | if nanos.is_some() { |
2254 | 0 | return Err(<A::Error as Error>::duplicate_field("nanos")); |
2255 | 0 | } |
2256 | 0 | nanos = Some(tri!(map.next_value())); |
2257 | | } |
2258 | | } |
2259 | | } |
2260 | 0 | let secs = match secs { |
2261 | 0 | Some(secs) => secs, |
2262 | 0 | None => return Err(<A::Error as Error>::missing_field("secs")), |
2263 | | }; |
2264 | 0 | let nanos = match nanos { |
2265 | 0 | Some(nanos) => nanos, |
2266 | 0 | None => return Err(<A::Error as Error>::missing_field("nanos")), |
2267 | | }; |
2268 | 0 | tri!(check_overflow(secs, nanos)); |
2269 | 0 | Ok(Duration::new(secs, nanos)) |
2270 | 0 | } |
2271 | | } |
2272 | | |
2273 | | const FIELDS: &[&str] = &["secs", "nanos"]; |
2274 | 0 | deserializer.deserialize_struct("Duration", FIELDS, DurationVisitor) |
2275 | 0 | } |
2276 | | } |
2277 | | |
2278 | | //////////////////////////////////////////////////////////////////////////////// |
2279 | | |
2280 | | #[cfg(feature = "std")] |
2281 | | #[cfg_attr(docsrs, doc(cfg(feature = "std")))] |
2282 | | impl<'de> Deserialize<'de> for SystemTime { |
2283 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2284 | 0 | where |
2285 | 0 | D: Deserializer<'de>, |
2286 | 0 | { |
2287 | | // Reuse duration |
2288 | | enum Field { |
2289 | | Secs, |
2290 | | Nanos, |
2291 | | } |
2292 | | |
2293 | | impl<'de> Deserialize<'de> for Field { |
2294 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2295 | 0 | where |
2296 | 0 | D: Deserializer<'de>, |
2297 | 0 | { |
2298 | | struct FieldVisitor; |
2299 | | |
2300 | | impl<'de> Visitor<'de> for FieldVisitor { |
2301 | | type Value = Field; |
2302 | | |
2303 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2304 | 0 | formatter.write_str("`secs_since_epoch` or `nanos_since_epoch`") |
2305 | 0 | } |
2306 | | |
2307 | 0 | fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> |
2308 | 0 | where |
2309 | 0 | E: Error, |
2310 | 0 | { |
2311 | 0 | match value { |
2312 | 0 | "secs_since_epoch" => Ok(Field::Secs), |
2313 | 0 | "nanos_since_epoch" => Ok(Field::Nanos), |
2314 | 0 | _ => Err(Error::unknown_field(value, FIELDS)), |
2315 | | } |
2316 | 0 | } |
2317 | | |
2318 | 0 | fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E> |
2319 | 0 | where |
2320 | 0 | E: Error, |
2321 | 0 | { |
2322 | 0 | match value { |
2323 | 0 | b"secs_since_epoch" => Ok(Field::Secs), |
2324 | 0 | b"nanos_since_epoch" => Ok(Field::Nanos), |
2325 | | _ => { |
2326 | 0 | let value = String::from_utf8_lossy(value); |
2327 | 0 | Err(Error::unknown_field(&value, FIELDS)) |
2328 | | } |
2329 | | } |
2330 | 0 | } |
2331 | | } |
2332 | | |
2333 | 0 | deserializer.deserialize_identifier(FieldVisitor) |
2334 | 0 | } |
2335 | | } |
2336 | | |
2337 | 0 | fn check_overflow<E>(secs: u64, nanos: u32) -> Result<(), E> |
2338 | 0 | where |
2339 | 0 | E: Error, |
2340 | 0 | { |
2341 | | static NANOS_PER_SEC: u32 = 1_000_000_000; |
2342 | 0 | match secs.checked_add((nanos / NANOS_PER_SEC) as u64) { |
2343 | 0 | Some(_) => Ok(()), |
2344 | 0 | None => Err(E::custom("overflow deserializing SystemTime epoch offset")), |
2345 | | } |
2346 | 0 | } |
2347 | | |
2348 | | struct DurationVisitor; |
2349 | | |
2350 | | impl<'de> Visitor<'de> for DurationVisitor { |
2351 | | type Value = Duration; |
2352 | | |
2353 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2354 | 0 | formatter.write_str("struct SystemTime") |
2355 | 0 | } |
2356 | | |
2357 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
2358 | 0 | where |
2359 | 0 | A: SeqAccess<'de>, |
2360 | 0 | { |
2361 | 0 | let secs: u64 = match tri!(seq.next_element()) { |
2362 | 0 | Some(value) => value, |
2363 | | None => { |
2364 | 0 | return Err(Error::invalid_length(0, &self)); |
2365 | | } |
2366 | | }; |
2367 | 0 | let nanos: u32 = match tri!(seq.next_element()) { |
2368 | 0 | Some(value) => value, |
2369 | | None => { |
2370 | 0 | return Err(Error::invalid_length(1, &self)); |
2371 | | } |
2372 | | }; |
2373 | 0 | tri!(check_overflow(secs, nanos)); |
2374 | 0 | Ok(Duration::new(secs, nanos)) |
2375 | 0 | } |
2376 | | |
2377 | 0 | fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> |
2378 | 0 | where |
2379 | 0 | A: MapAccess<'de>, |
2380 | 0 | { |
2381 | 0 | let mut secs: Option<u64> = None; |
2382 | 0 | let mut nanos: Option<u32> = None; |
2383 | 0 | while let Some(key) = tri!(map.next_key()) { |
2384 | 0 | match key { |
2385 | | Field::Secs => { |
2386 | 0 | if secs.is_some() { |
2387 | 0 | return Err(<A::Error as Error>::duplicate_field( |
2388 | 0 | "secs_since_epoch", |
2389 | 0 | )); |
2390 | 0 | } |
2391 | 0 | secs = Some(tri!(map.next_value())); |
2392 | | } |
2393 | | Field::Nanos => { |
2394 | 0 | if nanos.is_some() { |
2395 | 0 | return Err(<A::Error as Error>::duplicate_field( |
2396 | 0 | "nanos_since_epoch", |
2397 | 0 | )); |
2398 | 0 | } |
2399 | 0 | nanos = Some(tri!(map.next_value())); |
2400 | | } |
2401 | | } |
2402 | | } |
2403 | 0 | let secs = match secs { |
2404 | 0 | Some(secs) => secs, |
2405 | 0 | None => return Err(<A::Error as Error>::missing_field("secs_since_epoch")), |
2406 | | }; |
2407 | 0 | let nanos = match nanos { |
2408 | 0 | Some(nanos) => nanos, |
2409 | 0 | None => return Err(<A::Error as Error>::missing_field("nanos_since_epoch")), |
2410 | | }; |
2411 | 0 | tri!(check_overflow(secs, nanos)); |
2412 | 0 | Ok(Duration::new(secs, nanos)) |
2413 | 0 | } |
2414 | | } |
2415 | | |
2416 | | const FIELDS: &[&str] = &["secs_since_epoch", "nanos_since_epoch"]; |
2417 | 0 | let duration = tri!(deserializer.deserialize_struct("SystemTime", FIELDS, DurationVisitor)); |
2418 | | #[cfg(not(no_systemtime_checked_add))] |
2419 | 0 | let ret = UNIX_EPOCH |
2420 | 0 | .checked_add(duration) |
2421 | 0 | .ok_or_else(|| D::Error::custom("overflow deserializing SystemTime")); |
2422 | 0 | #[cfg(no_systemtime_checked_add)] |
2423 | 0 | let ret = Ok(UNIX_EPOCH + duration); |
2424 | 0 | ret |
2425 | 0 | } |
2426 | | } |
2427 | | |
2428 | | //////////////////////////////////////////////////////////////////////////////// |
2429 | | |
2430 | | // Similar to: |
2431 | | // |
2432 | | // #[derive(Deserialize)] |
2433 | | // #[serde(deny_unknown_fields)] |
2434 | | // struct Range<Idx> { |
2435 | | // start: Idx, |
2436 | | // end: Idx, |
2437 | | // } |
2438 | | impl<'de, Idx> Deserialize<'de> for Range<Idx> |
2439 | | where |
2440 | | Idx: Deserialize<'de>, |
2441 | | { |
2442 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2443 | 0 | where |
2444 | 0 | D: Deserializer<'de>, |
2445 | 0 | { |
2446 | 0 | let (start, end) = tri!(deserializer.deserialize_struct( |
2447 | 0 | "Range", |
2448 | 0 | range::FIELDS, |
2449 | 0 | range::RangeVisitor { |
2450 | 0 | expecting: "struct Range", |
2451 | 0 | phantom: PhantomData, |
2452 | 0 | }, |
2453 | 0 | )); |
2454 | 0 | Ok(start..end) |
2455 | 0 | } |
2456 | | } |
2457 | | |
2458 | | impl<'de, Idx> Deserialize<'de> for RangeInclusive<Idx> |
2459 | | where |
2460 | | Idx: Deserialize<'de>, |
2461 | | { |
2462 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2463 | 0 | where |
2464 | 0 | D: Deserializer<'de>, |
2465 | 0 | { |
2466 | 0 | let (start, end) = tri!(deserializer.deserialize_struct( |
2467 | 0 | "RangeInclusive", |
2468 | 0 | range::FIELDS, |
2469 | 0 | range::RangeVisitor { |
2470 | 0 | expecting: "struct RangeInclusive", |
2471 | 0 | phantom: PhantomData, |
2472 | 0 | }, |
2473 | 0 | )); |
2474 | 0 | Ok(RangeInclusive::new(start, end)) |
2475 | 0 | } |
2476 | | } |
2477 | | |
2478 | | mod range { |
2479 | | use crate::lib::*; |
2480 | | |
2481 | | use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; |
2482 | | |
2483 | | pub const FIELDS: &[&str] = &["start", "end"]; |
2484 | | |
2485 | | // If this were outside of the serde crate, it would just use: |
2486 | | // |
2487 | | // #[derive(Deserialize)] |
2488 | | // #[serde(field_identifier, rename_all = "lowercase")] |
2489 | | enum Field { |
2490 | | Start, |
2491 | | End, |
2492 | | } |
2493 | | |
2494 | | impl<'de> Deserialize<'de> for Field { |
2495 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2496 | 0 | where |
2497 | 0 | D: Deserializer<'de>, |
2498 | 0 | { |
2499 | | struct FieldVisitor; |
2500 | | |
2501 | | impl<'de> Visitor<'de> for FieldVisitor { |
2502 | | type Value = Field; |
2503 | | |
2504 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2505 | 0 | formatter.write_str("`start` or `end`") |
2506 | 0 | } |
2507 | | |
2508 | 0 | fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> |
2509 | 0 | where |
2510 | 0 | E: Error, |
2511 | 0 | { |
2512 | 0 | match value { |
2513 | 0 | "start" => Ok(Field::Start), |
2514 | 0 | "end" => Ok(Field::End), |
2515 | 0 | _ => Err(Error::unknown_field(value, FIELDS)), |
2516 | | } |
2517 | 0 | } |
2518 | | |
2519 | 0 | fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E> |
2520 | 0 | where |
2521 | 0 | E: Error, |
2522 | 0 | { |
2523 | 0 | match value { |
2524 | 0 | b"start" => Ok(Field::Start), |
2525 | 0 | b"end" => Ok(Field::End), |
2526 | | _ => { |
2527 | 0 | let value = crate::__private::from_utf8_lossy(value); |
2528 | 0 | Err(Error::unknown_field(&*value, FIELDS)) |
2529 | | } |
2530 | | } |
2531 | 0 | } |
2532 | | } |
2533 | | |
2534 | 0 | deserializer.deserialize_identifier(FieldVisitor) |
2535 | 0 | } |
2536 | | } |
2537 | | |
2538 | | pub struct RangeVisitor<Idx> { |
2539 | | pub expecting: &'static str, |
2540 | | pub phantom: PhantomData<Idx>, |
2541 | | } |
2542 | | |
2543 | | impl<'de, Idx> Visitor<'de> for RangeVisitor<Idx> |
2544 | | where |
2545 | | Idx: Deserialize<'de>, |
2546 | | { |
2547 | | type Value = (Idx, Idx); |
2548 | | |
2549 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2550 | 0 | formatter.write_str(self.expecting) |
2551 | 0 | } |
2552 | | |
2553 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
2554 | 0 | where |
2555 | 0 | A: SeqAccess<'de>, |
2556 | 0 | { |
2557 | 0 | let start: Idx = match tri!(seq.next_element()) { |
2558 | 0 | Some(value) => value, |
2559 | | None => { |
2560 | 0 | return Err(Error::invalid_length(0, &self)); |
2561 | | } |
2562 | | }; |
2563 | 0 | let end: Idx = match tri!(seq.next_element()) { |
2564 | 0 | Some(value) => value, |
2565 | | None => { |
2566 | 0 | return Err(Error::invalid_length(1, &self)); |
2567 | | } |
2568 | | }; |
2569 | 0 | Ok((start, end)) |
2570 | 0 | } |
2571 | | |
2572 | 0 | fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> |
2573 | 0 | where |
2574 | 0 | A: MapAccess<'de>, |
2575 | 0 | { |
2576 | 0 | let mut start: Option<Idx> = None; |
2577 | 0 | let mut end: Option<Idx> = None; |
2578 | 0 | while let Some(key) = tri!(map.next_key()) { |
2579 | 0 | match key { |
2580 | | Field::Start => { |
2581 | 0 | if start.is_some() { |
2582 | 0 | return Err(<A::Error as Error>::duplicate_field("start")); |
2583 | 0 | } |
2584 | 0 | start = Some(tri!(map.next_value())); |
2585 | | } |
2586 | | Field::End => { |
2587 | 0 | if end.is_some() { |
2588 | 0 | return Err(<A::Error as Error>::duplicate_field("end")); |
2589 | 0 | } |
2590 | 0 | end = Some(tri!(map.next_value())); |
2591 | | } |
2592 | | } |
2593 | | } |
2594 | 0 | let start = match start { |
2595 | 0 | Some(start) => start, |
2596 | 0 | None => return Err(<A::Error as Error>::missing_field("start")), |
2597 | | }; |
2598 | 0 | let end = match end { |
2599 | 0 | Some(end) => end, |
2600 | 0 | None => return Err(<A::Error as Error>::missing_field("end")), |
2601 | | }; |
2602 | 0 | Ok((start, end)) |
2603 | 0 | } |
2604 | | } |
2605 | | } |
2606 | | |
2607 | | //////////////////////////////////////////////////////////////////////////////// |
2608 | | |
2609 | | // Similar to: |
2610 | | // |
2611 | | // #[derive(Deserialize)] |
2612 | | // #[serde(deny_unknown_fields)] |
2613 | | // struct RangeFrom<Idx> { |
2614 | | // start: Idx, |
2615 | | // } |
2616 | | impl<'de, Idx> Deserialize<'de> for RangeFrom<Idx> |
2617 | | where |
2618 | | Idx: Deserialize<'de>, |
2619 | | { |
2620 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2621 | 0 | where |
2622 | 0 | D: Deserializer<'de>, |
2623 | 0 | { |
2624 | 0 | let start = tri!(deserializer.deserialize_struct( |
2625 | 0 | "RangeFrom", |
2626 | 0 | range_from::FIELDS, |
2627 | 0 | range_from::RangeFromVisitor { |
2628 | 0 | expecting: "struct RangeFrom", |
2629 | 0 | phantom: PhantomData, |
2630 | 0 | }, |
2631 | 0 | )); |
2632 | 0 | Ok(start..) |
2633 | 0 | } |
2634 | | } |
2635 | | |
2636 | | mod range_from { |
2637 | | use crate::lib::*; |
2638 | | |
2639 | | use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; |
2640 | | |
2641 | | pub const FIELDS: &[&str] = &["start"]; |
2642 | | |
2643 | | // If this were outside of the serde crate, it would just use: |
2644 | | // |
2645 | | // #[derive(Deserialize)] |
2646 | | // #[serde(field_identifier, rename_all = "lowercase")] |
2647 | | enum Field { |
2648 | | Start, |
2649 | | } |
2650 | | |
2651 | | impl<'de> Deserialize<'de> for Field { |
2652 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2653 | 0 | where |
2654 | 0 | D: Deserializer<'de>, |
2655 | 0 | { |
2656 | | struct FieldVisitor; |
2657 | | |
2658 | | impl<'de> Visitor<'de> for FieldVisitor { |
2659 | | type Value = Field; |
2660 | | |
2661 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2662 | 0 | formatter.write_str("`start`") |
2663 | 0 | } |
2664 | | |
2665 | 0 | fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> |
2666 | 0 | where |
2667 | 0 | E: Error, |
2668 | 0 | { |
2669 | 0 | match value { |
2670 | 0 | "start" => Ok(Field::Start), |
2671 | 0 | _ => Err(Error::unknown_field(value, FIELDS)), |
2672 | | } |
2673 | 0 | } |
2674 | | |
2675 | 0 | fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E> |
2676 | 0 | where |
2677 | 0 | E: Error, |
2678 | 0 | { |
2679 | 0 | match value { |
2680 | 0 | b"start" => Ok(Field::Start), |
2681 | | _ => { |
2682 | 0 | let value = crate::__private::from_utf8_lossy(value); |
2683 | 0 | Err(Error::unknown_field(&*value, FIELDS)) |
2684 | | } |
2685 | | } |
2686 | 0 | } |
2687 | | } |
2688 | | |
2689 | 0 | deserializer.deserialize_identifier(FieldVisitor) |
2690 | 0 | } |
2691 | | } |
2692 | | |
2693 | | pub struct RangeFromVisitor<Idx> { |
2694 | | pub expecting: &'static str, |
2695 | | pub phantom: PhantomData<Idx>, |
2696 | | } |
2697 | | |
2698 | | impl<'de, Idx> Visitor<'de> for RangeFromVisitor<Idx> |
2699 | | where |
2700 | | Idx: Deserialize<'de>, |
2701 | | { |
2702 | | type Value = Idx; |
2703 | | |
2704 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2705 | 0 | formatter.write_str(self.expecting) |
2706 | 0 | } |
2707 | | |
2708 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
2709 | 0 | where |
2710 | 0 | A: SeqAccess<'de>, |
2711 | 0 | { |
2712 | 0 | let start: Idx = match tri!(seq.next_element()) { |
2713 | 0 | Some(value) => value, |
2714 | | None => { |
2715 | 0 | return Err(Error::invalid_length(0, &self)); |
2716 | | } |
2717 | | }; |
2718 | 0 | Ok(start) |
2719 | 0 | } |
2720 | | |
2721 | 0 | fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> |
2722 | 0 | where |
2723 | 0 | A: MapAccess<'de>, |
2724 | 0 | { |
2725 | 0 | let mut start: Option<Idx> = None; |
2726 | 0 | while let Some(key) = tri!(map.next_key()) { |
2727 | 0 | match key { |
2728 | 0 | Field::Start => { |
2729 | 0 | if start.is_some() { |
2730 | 0 | return Err(<A::Error as Error>::duplicate_field("start")); |
2731 | 0 | } |
2732 | 0 | start = Some(tri!(map.next_value())); |
2733 | | } |
2734 | | } |
2735 | | } |
2736 | 0 | let start = match start { |
2737 | 0 | Some(start) => start, |
2738 | 0 | None => return Err(<A::Error as Error>::missing_field("start")), |
2739 | | }; |
2740 | 0 | Ok(start) |
2741 | 0 | } |
2742 | | } |
2743 | | } |
2744 | | |
2745 | | //////////////////////////////////////////////////////////////////////////////// |
2746 | | |
2747 | | // Similar to: |
2748 | | // |
2749 | | // #[derive(Deserialize)] |
2750 | | // #[serde(deny_unknown_fields)] |
2751 | | // struct RangeTo<Idx> { |
2752 | | // end: Idx, |
2753 | | // } |
2754 | | impl<'de, Idx> Deserialize<'de> for RangeTo<Idx> |
2755 | | where |
2756 | | Idx: Deserialize<'de>, |
2757 | | { |
2758 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2759 | 0 | where |
2760 | 0 | D: Deserializer<'de>, |
2761 | 0 | { |
2762 | 0 | let end = tri!(deserializer.deserialize_struct( |
2763 | 0 | "RangeTo", |
2764 | 0 | range_to::FIELDS, |
2765 | 0 | range_to::RangeToVisitor { |
2766 | 0 | expecting: "struct RangeTo", |
2767 | 0 | phantom: PhantomData, |
2768 | 0 | }, |
2769 | 0 | )); |
2770 | 0 | Ok(..end) |
2771 | 0 | } |
2772 | | } |
2773 | | |
2774 | | mod range_to { |
2775 | | use crate::lib::*; |
2776 | | |
2777 | | use crate::de::{Deserialize, Deserializer, Error, MapAccess, SeqAccess, Visitor}; |
2778 | | |
2779 | | pub const FIELDS: &[&str] = &["end"]; |
2780 | | |
2781 | | // If this were outside of the serde crate, it would just use: |
2782 | | // |
2783 | | // #[derive(Deserialize)] |
2784 | | // #[serde(field_identifier, rename_all = "lowercase")] |
2785 | | enum Field { |
2786 | | End, |
2787 | | } |
2788 | | |
2789 | | impl<'de> Deserialize<'de> for Field { |
2790 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2791 | 0 | where |
2792 | 0 | D: Deserializer<'de>, |
2793 | 0 | { |
2794 | | struct FieldVisitor; |
2795 | | |
2796 | | impl<'de> Visitor<'de> for FieldVisitor { |
2797 | | type Value = Field; |
2798 | | |
2799 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2800 | 0 | formatter.write_str("`end`") |
2801 | 0 | } |
2802 | | |
2803 | 0 | fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> |
2804 | 0 | where |
2805 | 0 | E: Error, |
2806 | 0 | { |
2807 | 0 | match value { |
2808 | 0 | "end" => Ok(Field::End), |
2809 | 0 | _ => Err(Error::unknown_field(value, FIELDS)), |
2810 | | } |
2811 | 0 | } |
2812 | | |
2813 | 0 | fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E> |
2814 | 0 | where |
2815 | 0 | E: Error, |
2816 | 0 | { |
2817 | 0 | match value { |
2818 | 0 | b"end" => Ok(Field::End), |
2819 | | _ => { |
2820 | 0 | let value = crate::__private::from_utf8_lossy(value); |
2821 | 0 | Err(Error::unknown_field(&*value, FIELDS)) |
2822 | | } |
2823 | | } |
2824 | 0 | } |
2825 | | } |
2826 | | |
2827 | 0 | deserializer.deserialize_identifier(FieldVisitor) |
2828 | 0 | } |
2829 | | } |
2830 | | |
2831 | | pub struct RangeToVisitor<Idx> { |
2832 | | pub expecting: &'static str, |
2833 | | pub phantom: PhantomData<Idx>, |
2834 | | } |
2835 | | |
2836 | | impl<'de, Idx> Visitor<'de> for RangeToVisitor<Idx> |
2837 | | where |
2838 | | Idx: Deserialize<'de>, |
2839 | | { |
2840 | | type Value = Idx; |
2841 | | |
2842 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2843 | 0 | formatter.write_str(self.expecting) |
2844 | 0 | } |
2845 | | |
2846 | 0 | fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> |
2847 | 0 | where |
2848 | 0 | A: SeqAccess<'de>, |
2849 | 0 | { |
2850 | 0 | let end: Idx = match tri!(seq.next_element()) { |
2851 | 0 | Some(value) => value, |
2852 | | None => { |
2853 | 0 | return Err(Error::invalid_length(0, &self)); |
2854 | | } |
2855 | | }; |
2856 | 0 | Ok(end) |
2857 | 0 | } |
2858 | | |
2859 | 0 | fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> |
2860 | 0 | where |
2861 | 0 | A: MapAccess<'de>, |
2862 | 0 | { |
2863 | 0 | let mut end: Option<Idx> = None; |
2864 | 0 | while let Some(key) = tri!(map.next_key()) { |
2865 | 0 | match key { |
2866 | 0 | Field::End => { |
2867 | 0 | if end.is_some() { |
2868 | 0 | return Err(<A::Error as Error>::duplicate_field("end")); |
2869 | 0 | } |
2870 | 0 | end = Some(tri!(map.next_value())); |
2871 | | } |
2872 | | } |
2873 | | } |
2874 | 0 | let end = match end { |
2875 | 0 | Some(end) => end, |
2876 | 0 | None => return Err(<A::Error as Error>::missing_field("end")), |
2877 | | }; |
2878 | 0 | Ok(end) |
2879 | 0 | } |
2880 | | } |
2881 | | } |
2882 | | |
2883 | | //////////////////////////////////////////////////////////////////////////////// |
2884 | | |
2885 | | impl<'de, T> Deserialize<'de> for Bound<T> |
2886 | | where |
2887 | | T: Deserialize<'de>, |
2888 | | { |
2889 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2890 | 0 | where |
2891 | 0 | D: Deserializer<'de>, |
2892 | 0 | { |
2893 | | enum Field { |
2894 | | Unbounded, |
2895 | | Included, |
2896 | | Excluded, |
2897 | | } |
2898 | | |
2899 | | impl<'de> Deserialize<'de> for Field { |
2900 | | #[inline] |
2901 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2902 | 0 | where |
2903 | 0 | D: Deserializer<'de>, |
2904 | 0 | { |
2905 | | struct FieldVisitor; |
2906 | | |
2907 | | impl<'de> Visitor<'de> for FieldVisitor { |
2908 | | type Value = Field; |
2909 | | |
2910 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2911 | 0 | formatter.write_str("`Unbounded`, `Included` or `Excluded`") |
2912 | 0 | } |
2913 | | |
2914 | 0 | fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E> |
2915 | 0 | where |
2916 | 0 | E: Error, |
2917 | 0 | { |
2918 | 0 | match value { |
2919 | 0 | 0 => Ok(Field::Unbounded), |
2920 | 0 | 1 => Ok(Field::Included), |
2921 | 0 | 2 => Ok(Field::Excluded), |
2922 | 0 | _ => Err(Error::invalid_value(Unexpected::Unsigned(value), &self)), |
2923 | | } |
2924 | 0 | } |
2925 | | |
2926 | 0 | fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> |
2927 | 0 | where |
2928 | 0 | E: Error, |
2929 | 0 | { |
2930 | 0 | match value { |
2931 | 0 | "Unbounded" => Ok(Field::Unbounded), |
2932 | 0 | "Included" => Ok(Field::Included), |
2933 | 0 | "Excluded" => Ok(Field::Excluded), |
2934 | 0 | _ => Err(Error::unknown_variant(value, VARIANTS)), |
2935 | | } |
2936 | 0 | } |
2937 | | |
2938 | 0 | fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E> |
2939 | 0 | where |
2940 | 0 | E: Error, |
2941 | 0 | { |
2942 | 0 | match value { |
2943 | 0 | b"Unbounded" => Ok(Field::Unbounded), |
2944 | 0 | b"Included" => Ok(Field::Included), |
2945 | 0 | b"Excluded" => Ok(Field::Excluded), |
2946 | 0 | _ => match str::from_utf8(value) { |
2947 | 0 | Ok(value) => Err(Error::unknown_variant(value, VARIANTS)), |
2948 | | Err(_) => { |
2949 | 0 | Err(Error::invalid_value(Unexpected::Bytes(value), &self)) |
2950 | | } |
2951 | | }, |
2952 | | } |
2953 | 0 | } |
2954 | | } |
2955 | | |
2956 | 0 | deserializer.deserialize_identifier(FieldVisitor) |
2957 | 0 | } |
2958 | | } |
2959 | | |
2960 | | struct BoundVisitor<T>(PhantomData<Bound<T>>); |
2961 | | |
2962 | | impl<'de, T> Visitor<'de> for BoundVisitor<T> |
2963 | | where |
2964 | | T: Deserialize<'de>, |
2965 | | { |
2966 | | type Value = Bound<T>; |
2967 | | |
2968 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
2969 | 0 | formatter.write_str("enum Bound") |
2970 | 0 | } |
2971 | | |
2972 | 0 | fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error> |
2973 | 0 | where |
2974 | 0 | A: EnumAccess<'de>, |
2975 | 0 | { |
2976 | 0 | match tri!(data.variant()) { |
2977 | 0 | (Field::Unbounded, v) => v.unit_variant().map(|()| Bound::Unbounded), |
2978 | 0 | (Field::Included, v) => v.newtype_variant().map(Bound::Included), |
2979 | 0 | (Field::Excluded, v) => v.newtype_variant().map(Bound::Excluded), |
2980 | | } |
2981 | 0 | } |
2982 | | } |
2983 | | |
2984 | | const VARIANTS: &[&str] = &["Unbounded", "Included", "Excluded"]; |
2985 | | |
2986 | 0 | deserializer.deserialize_enum("Bound", VARIANTS, BoundVisitor(PhantomData)) |
2987 | 0 | } |
2988 | | } |
2989 | | |
2990 | | //////////////////////////////////////////////////////////////////////////////// |
2991 | | |
2992 | | impl<'de, T, E> Deserialize<'de> for Result<T, E> |
2993 | | where |
2994 | | T: Deserialize<'de>, |
2995 | | E: Deserialize<'de>, |
2996 | | { |
2997 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
2998 | 0 | where |
2999 | 0 | D: Deserializer<'de>, |
3000 | 0 | { |
3001 | | // If this were outside of the serde crate, it would just use: |
3002 | | // |
3003 | | // #[derive(Deserialize)] |
3004 | | // #[serde(variant_identifier)] |
3005 | | enum Field { |
3006 | | Ok, |
3007 | | Err, |
3008 | | } |
3009 | | |
3010 | | impl<'de> Deserialize<'de> for Field { |
3011 | | #[inline] |
3012 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
3013 | 0 | where |
3014 | 0 | D: Deserializer<'de>, |
3015 | 0 | { |
3016 | | struct FieldVisitor; |
3017 | | |
3018 | | impl<'de> Visitor<'de> for FieldVisitor { |
3019 | | type Value = Field; |
3020 | | |
3021 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
3022 | 0 | formatter.write_str("`Ok` or `Err`") |
3023 | 0 | } |
3024 | | |
3025 | 0 | fn visit_u64<E>(self, value: u64) -> Result<Self::Value, E> |
3026 | 0 | where |
3027 | 0 | E: Error, |
3028 | 0 | { |
3029 | 0 | match value { |
3030 | 0 | 0 => Ok(Field::Ok), |
3031 | 0 | 1 => Ok(Field::Err), |
3032 | 0 | _ => Err(Error::invalid_value(Unexpected::Unsigned(value), &self)), |
3033 | | } |
3034 | 0 | } |
3035 | | |
3036 | 0 | fn visit_str<E>(self, value: &str) -> Result<Self::Value, E> |
3037 | 0 | where |
3038 | 0 | E: Error, |
3039 | 0 | { |
3040 | 0 | match value { |
3041 | 0 | "Ok" => Ok(Field::Ok), |
3042 | 0 | "Err" => Ok(Field::Err), |
3043 | 0 | _ => Err(Error::unknown_variant(value, VARIANTS)), |
3044 | | } |
3045 | 0 | } |
3046 | | |
3047 | 0 | fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E> |
3048 | 0 | where |
3049 | 0 | E: Error, |
3050 | 0 | { |
3051 | 0 | match value { |
3052 | 0 | b"Ok" => Ok(Field::Ok), |
3053 | 0 | b"Err" => Ok(Field::Err), |
3054 | 0 | _ => match str::from_utf8(value) { |
3055 | 0 | Ok(value) => Err(Error::unknown_variant(value, VARIANTS)), |
3056 | | Err(_) => { |
3057 | 0 | Err(Error::invalid_value(Unexpected::Bytes(value), &self)) |
3058 | | } |
3059 | | }, |
3060 | | } |
3061 | 0 | } |
3062 | | } |
3063 | | |
3064 | 0 | deserializer.deserialize_identifier(FieldVisitor) |
3065 | 0 | } |
3066 | | } |
3067 | | |
3068 | | struct ResultVisitor<T, E>(PhantomData<Result<T, E>>); |
3069 | | |
3070 | | impl<'de, T, E> Visitor<'de> for ResultVisitor<T, E> |
3071 | | where |
3072 | | T: Deserialize<'de>, |
3073 | | E: Deserialize<'de>, |
3074 | | { |
3075 | | type Value = Result<T, E>; |
3076 | | |
3077 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
3078 | 0 | formatter.write_str("enum Result") |
3079 | 0 | } |
3080 | | |
3081 | 0 | fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error> |
3082 | 0 | where |
3083 | 0 | A: EnumAccess<'de>, |
3084 | 0 | { |
3085 | 0 | match tri!(data.variant()) { |
3086 | 0 | (Field::Ok, v) => v.newtype_variant().map(Ok), |
3087 | 0 | (Field::Err, v) => v.newtype_variant().map(Err), |
3088 | | } |
3089 | 0 | } |
3090 | | } |
3091 | | |
3092 | | const VARIANTS: &[&str] = &["Ok", "Err"]; |
3093 | | |
3094 | 0 | deserializer.deserialize_enum("Result", VARIANTS, ResultVisitor(PhantomData)) |
3095 | 0 | } |
3096 | | } |
3097 | | |
3098 | | //////////////////////////////////////////////////////////////////////////////// |
3099 | | |
3100 | | impl<'de, T> Deserialize<'de> for Wrapping<T> |
3101 | | where |
3102 | | T: Deserialize<'de>, |
3103 | | { |
3104 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
3105 | 0 | where |
3106 | 0 | D: Deserializer<'de>, |
3107 | 0 | { |
3108 | 0 | Deserialize::deserialize(deserializer).map(Wrapping) |
3109 | 0 | } |
3110 | | } |
3111 | | |
3112 | | #[cfg(all(feature = "std", not(no_std_atomic)))] |
3113 | | macro_rules! atomic_impl { |
3114 | | ($($ty:ident $size:expr)*) => { |
3115 | | $( |
3116 | | #[cfg(any(no_target_has_atomic, target_has_atomic = $size))] |
3117 | | #[cfg_attr(docsrs, doc(cfg(all(feature = "std", target_has_atomic = $size))))] |
3118 | | impl<'de> Deserialize<'de> for $ty { |
3119 | 0 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
3120 | 0 | where |
3121 | 0 | D: Deserializer<'de>, |
3122 | 0 | { |
3123 | 0 | Deserialize::deserialize(deserializer).map(Self::new) |
3124 | 0 | } Unexecuted instantiation: <core::sync::atomic::AtomicBool as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicI8 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicI16 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicI32 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicIsize as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicU8 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicU16 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicU32 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicUsize as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicI64 as serde::de::Deserialize>::deserialize::<_> Unexecuted instantiation: <core::sync::atomic::AtomicU64 as serde::de::Deserialize>::deserialize::<_> |
3125 | | } |
3126 | | )* |
3127 | | }; |
3128 | | } |
3129 | | |
3130 | | #[cfg(all(feature = "std", not(no_std_atomic)))] |
3131 | | atomic_impl! { |
3132 | | AtomicBool "8" |
3133 | | AtomicI8 "8" |
3134 | | AtomicI16 "16" |
3135 | | AtomicI32 "32" |
3136 | | AtomicIsize "ptr" |
3137 | | AtomicU8 "8" |
3138 | | AtomicU16 "16" |
3139 | | AtomicU32 "32" |
3140 | | AtomicUsize "ptr" |
3141 | | } |
3142 | | |
3143 | | #[cfg(all(feature = "std", not(no_std_atomic64)))] |
3144 | | atomic_impl! { |
3145 | | AtomicI64 "64" |
3146 | | AtomicU64 "64" |
3147 | | } |
3148 | | |
3149 | | #[cfg(any(feature = "std", not(no_core_net)))] |
3150 | | struct FromStrVisitor<T> { |
3151 | | expecting: &'static str, |
3152 | | ty: PhantomData<T>, |
3153 | | } |
3154 | | |
3155 | | #[cfg(any(feature = "std", not(no_core_net)))] |
3156 | | impl<T> FromStrVisitor<T> { |
3157 | 0 | fn new(expecting: &'static str) -> Self { |
3158 | 0 | FromStrVisitor { |
3159 | 0 | expecting, |
3160 | 0 | ty: PhantomData, |
3161 | 0 | } |
3162 | 0 | } |
3163 | | } |
3164 | | |
3165 | | #[cfg(any(feature = "std", not(no_core_net)))] |
3166 | | impl<'de, T> Visitor<'de> for FromStrVisitor<T> |
3167 | | where |
3168 | | T: str::FromStr, |
3169 | | T::Err: fmt::Display, |
3170 | | { |
3171 | | type Value = T; |
3172 | | |
3173 | 0 | fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
3174 | 0 | formatter.write_str(self.expecting) |
3175 | 0 | } |
3176 | | |
3177 | 0 | fn visit_str<E>(self, s: &str) -> Result<Self::Value, E> |
3178 | 0 | where |
3179 | 0 | E: Error, |
3180 | 0 | { |
3181 | 0 | s.parse().map_err(Error::custom) |
3182 | 0 | } |
3183 | | } |