Reorder methods to match the serializer trait

This commit is contained in:
David Tolnay 2017-04-14 15:24:21 -07:00
parent 337c6e91d8
commit 5b118fdef4
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
6 changed files with 181 additions and 177 deletions

View File

@ -130,32 +130,36 @@ macro_rules! impl_deserialize_num {
} }
} }
}; };
(integer $ty:ident) => { (integer $ty:ident) => {
visit_integer_method!(i8, visit_i8, from_i8, Signed, i64); visit_integer_method!(i8, visit_i8, from_i8, Signed, i64);
visit_integer_method!(i16, visit_i16, from_i16, Signed, i64); visit_integer_method!(i16, visit_i16, from_i16, Signed, i64);
visit_integer_method!(i32, visit_i32, from_i32, Signed, i64); visit_integer_method!(i32, visit_i32, from_i32, Signed, i64);
visit_integer_method!(i64, visit_i64, from_i64, Signed, i64); visit_integer_method!(i64, visit_i64, from_i64, Signed, i64);
visit_integer_method!(u8, visit_u8, from_u8, Unsigned, u64); visit_integer_method!(u8, visit_u8, from_u8, Unsigned, u64);
visit_integer_method!(u16, visit_u16, from_u16, Unsigned, u64); visit_integer_method!(u16, visit_u16, from_u16, Unsigned, u64);
visit_integer_method!(u32, visit_u32, from_u32, Unsigned, u64); visit_integer_method!(u32, visit_u32, from_u32, Unsigned, u64);
visit_integer_method!(u64, visit_u64, from_u64, Unsigned, u64); visit_integer_method!(u64, visit_u64, from_u64, Unsigned, u64);
}; };
(float $ty:ident) => { (float $ty:ident) => {
visit_float_method!(f32, visit_f32); visit_float_method!(f32, visit_f32);
visit_float_method!(f64, visit_f64); visit_float_method!(f64, visit_f64);
}; };
} }
impl_deserialize_num!(isize, deserialize_i64, integer);
impl_deserialize_num!(i8, deserialize_i8, integer); impl_deserialize_num!(i8, deserialize_i8, integer);
impl_deserialize_num!(i16, deserialize_i16, integer); impl_deserialize_num!(i16, deserialize_i16, integer);
impl_deserialize_num!(i32, deserialize_i32, integer); impl_deserialize_num!(i32, deserialize_i32, integer);
impl_deserialize_num!(i64, deserialize_i64, integer); impl_deserialize_num!(i64, deserialize_i64, integer);
impl_deserialize_num!(usize, deserialize_u64, integer); impl_deserialize_num!(isize, deserialize_i64, integer);
impl_deserialize_num!(u8, deserialize_u8, integer); impl_deserialize_num!(u8, deserialize_u8, integer);
impl_deserialize_num!(u16, deserialize_u16, integer); impl_deserialize_num!(u16, deserialize_u16, integer);
impl_deserialize_num!(u32, deserialize_u32, integer); impl_deserialize_num!(u32, deserialize_u32, integer);
impl_deserialize_num!(u64, deserialize_u64, integer); impl_deserialize_num!(u64, deserialize_u64, integer);
impl_deserialize_num!(usize, deserialize_u64, integer);
impl_deserialize_num!(f32, deserialize_f32, integer, float); impl_deserialize_num!(f32, deserialize_f32, integer, float);
impl_deserialize_num!(f64, deserialize_f64, integer, float); impl_deserialize_num!(f64, deserialize_f64, integer, float);

View File

@ -804,26 +804,6 @@ pub trait Deserializer<'de>: Sized {
where where
V: Visitor<'de>; V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting a `u8` value.
fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting a `u16` value.
fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting a `u32` value.
fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting a `u64` value.
fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting an `i8` value. /// Hint that the `Deserialize` type is expecting an `i8` value.
fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error> fn deserialize_i8<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where where
@ -844,6 +824,26 @@ pub trait Deserializer<'de>: Sized {
where where
V: Visitor<'de>; V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting a `u8` value.
fn deserialize_u8<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting a `u16` value.
fn deserialize_u16<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting a `u32` value.
fn deserialize_u32<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting a `u64` value.
fn deserialize_u64<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
V: Visitor<'de>;
/// Hint that the `Deserialize` type is expecting a `f32` value. /// Hint that the `Deserialize` type is expecting a `f32` value.
fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error> fn deserialize_f32<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where where
@ -1225,67 +1225,6 @@ pub trait Visitor<'de>: Sized {
self.visit_str(&v) self.visit_str(&v)
} }
/// Deserialize a `()` into a `Value`.
fn visit_unit<E>(self) -> Result<Self::Value, E>
where
E: Error,
{
Err(Error::invalid_type(Unexpected::Unit, &self))
}
/// Deserialize an absent optional `Value`.
fn visit_none<E>(self) -> Result<Self::Value, E>
where
E: Error,
{
Err(Error::invalid_type(Unexpected::Option, &self))
}
/// Deserialize a present optional `Value`.
fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: Deserializer<'de>,
{
let _ = deserializer;
Err(Error::invalid_type(Unexpected::Option, &self))
}
/// Deserialize `Value` as a newtype struct.
fn visit_newtype_struct<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: Deserializer<'de>,
{
let _ = deserializer;
Err(Error::invalid_type(Unexpected::NewtypeStruct, &self))
}
/// Deserialize `Value` as a sequence of elements.
fn visit_seq<A>(self, seq: A) -> Result<Self::Value, A::Error>
where
A: SeqAccess<'de>,
{
let _ = seq;
Err(Error::invalid_type(Unexpected::Seq, &self))
}
/// Deserialize `Value` as a key-value map.
fn visit_map<A>(self, map: A) -> Result<Self::Value, A::Error>
where
A: MapAccess<'de>,
{
let _ = map;
Err(Error::invalid_type(Unexpected::Map, &self))
}
/// Deserialize `Value` as an enum.
fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error>
where
A: EnumAccess<'de>,
{
let _ = data;
Err(Error::invalid_type(Unexpected::Enum, &self))
}
/// Deserialize a `&[u8]` into a `Value`. /// Deserialize a `&[u8]` into a `Value`.
/// ///
/// This method allows the `Deserializer` to avoid a copy by retaining /// This method allows the `Deserializer` to avoid a copy by retaining
@ -1341,6 +1280,67 @@ pub trait Visitor<'de>: Sized {
{ {
self.visit_bytes(&v) self.visit_bytes(&v)
} }
/// Deserialize an absent optional `Value`.
fn visit_none<E>(self) -> Result<Self::Value, E>
where
E: Error,
{
Err(Error::invalid_type(Unexpected::Option, &self))
}
/// Deserialize a present optional `Value`.
fn visit_some<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: Deserializer<'de>,
{
let _ = deserializer;
Err(Error::invalid_type(Unexpected::Option, &self))
}
/// Deserialize a `()` into a `Value`.
fn visit_unit<E>(self) -> Result<Self::Value, E>
where
E: Error,
{
Err(Error::invalid_type(Unexpected::Unit, &self))
}
/// Deserialize `Value` as a newtype struct.
fn visit_newtype_struct<D>(self, deserializer: D) -> Result<Self::Value, D::Error>
where
D: Deserializer<'de>,
{
let _ = deserializer;
Err(Error::invalid_type(Unexpected::NewtypeStruct, &self))
}
/// Deserialize `Value` as a sequence of elements.
fn visit_seq<A>(self, seq: A) -> Result<Self::Value, A::Error>
where
A: SeqAccess<'de>,
{
let _ = seq;
Err(Error::invalid_type(Unexpected::Seq, &self))
}
/// Deserialize `Value` as a key-value map.
fn visit_map<A>(self, map: A) -> Result<Self::Value, A::Error>
where
A: MapAccess<'de>,
{
let _ = map;
Err(Error::invalid_type(Unexpected::Map, &self))
}
/// Deserialize `Value` as an enum.
fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error>
where
A: EnumAccess<'de>,
{
let _ = data;
Err(Error::invalid_type(Unexpected::Enum, &self))
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -129,9 +129,9 @@ where
type Error = E; type Error = E;
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit seq bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq_fixed_size bytes map unit_struct newtype_struct tuple_struct struct byte_buf unit unit_struct newtype_struct seq seq_fixed_size tuple
identifier tuple enum ignored_any byte_buf tuple_struct map struct identifier enum ignored_any
} }
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
@ -182,9 +182,9 @@ macro_rules! primitive_deserializer {
type Error = E; type Error = E;
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
option seq seq_fixed_size bytes map unit_struct newtype_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
tuple_struct struct identifier tuple enum ignored_any byte_buf tuple tuple_struct map struct identifier enum ignored_any
} }
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
@ -239,9 +239,9 @@ where
type Error = E; type Error = E;
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
struct identifier tuple ignored_any byte_buf tuple tuple_struct map struct identifier ignored_any
} }
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
@ -332,9 +332,9 @@ where
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
struct identifier tuple ignored_any byte_buf tuple tuple_struct map struct identifier ignored_any
} }
} }
@ -407,9 +407,9 @@ where
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
struct identifier tuple ignored_any byte_buf tuple tuple_struct map struct identifier ignored_any
} }
} }
@ -486,9 +486,9 @@ where
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
struct identifier tuple ignored_any byte_buf tuple tuple_struct map struct identifier ignored_any
} }
} }
@ -572,9 +572,9 @@ where
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
struct identifier tuple enum ignored_any byte_buf tuple tuple_struct map struct identifier enum ignored_any
} }
} }
@ -686,9 +686,9 @@ where
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
struct identifier tuple enum ignored_any byte_buf tuple tuple_struct map struct identifier enum ignored_any
} }
} }
@ -804,9 +804,9 @@ where
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
bytes map unit_struct newtype_struct tuple_struct struct identifier byte_buf option unit unit_struct newtype_struct tuple tuple_struct
tuple enum ignored_any byte_buf map struct identifier enum ignored_any
} }
} }
@ -945,9 +945,9 @@ where
type Error = E; type Error = E;
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
bytes map unit_struct newtype_struct tuple_struct struct identifier byte_buf option unit unit_struct newtype_struct tuple tuple_struct
tuple enum ignored_any byte_buf map struct identifier enum ignored_any
} }
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error> fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
@ -1092,9 +1092,9 @@ where
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
struct identifier tuple enum ignored_any byte_buf tuple tuple_struct map struct identifier enum ignored_any
} }
} }

View File

@ -77,9 +77,9 @@
/// } /// }
/// ///
/// forward_to_deserialize_any! { /// forward_to_deserialize_any! {
/// bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option /// bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
/// seq seq_fixed_size bytes byte_buf map unit_struct newtype_struct /// byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
/// tuple_struct struct identifier tuple enum ignored_any /// tuple tuple_struct map struct identifier enum ignored_any
/// } /// }
/// } /// }
/// # /// #
@ -112,9 +112,9 @@
/// # /// #
/// forward_to_deserialize_any! { /// forward_to_deserialize_any! {
/// <W: Visitor<'q>> /// <W: Visitor<'q>>
/// bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option /// bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
/// seq seq_fixed_size bytes byte_buf map unit_struct newtype_struct /// byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
/// tuple_struct struct identifier tuple enum ignored_any /// tuple tuple_struct map struct identifier enum ignored_any
/// } /// }
/// # } /// # }
/// # /// #
@ -158,18 +158,6 @@ macro_rules! forward_to_deserialize_any_helper {
(bool<$l:tt, $v:ident>) => { (bool<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_bool<$l, $v>()} forward_to_deserialize_any_method!{deserialize_bool<$l, $v>()}
}; };
(u8<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_u8<$l, $v>()}
};
(u16<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_u16<$l, $v>()}
};
(u32<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_u32<$l, $v>()}
};
(u64<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_u64<$l, $v>()}
};
(i8<$l:tt, $v:ident>) => { (i8<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_i8<$l, $v>()} forward_to_deserialize_any_method!{deserialize_i8<$l, $v>()}
}; };
@ -182,6 +170,18 @@ macro_rules! forward_to_deserialize_any_helper {
(i64<$l:tt, $v:ident>) => { (i64<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_i64<$l, $v>()} forward_to_deserialize_any_method!{deserialize_i64<$l, $v>()}
}; };
(u8<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_u8<$l, $v>()}
};
(u16<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_u16<$l, $v>()}
};
(u32<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_u32<$l, $v>()}
};
(u64<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_u64<$l, $v>()}
};
(f32<$l:tt, $v:ident>) => { (f32<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_f32<$l, $v>()} forward_to_deserialize_any_method!{deserialize_f32<$l, $v>()}
}; };
@ -197,26 +197,17 @@ macro_rules! forward_to_deserialize_any_helper {
(string<$l:tt, $v:ident>) => { (string<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_string<$l, $v>()} forward_to_deserialize_any_method!{deserialize_string<$l, $v>()}
}; };
(unit<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_unit<$l, $v>()}
};
(option<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_option<$l, $v>()}
};
(seq<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_seq<$l, $v>()}
};
(seq_fixed_size<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_seq_fixed_size<$l, $v>(len: usize)}
};
(bytes<$l:tt, $v:ident>) => { (bytes<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_bytes<$l, $v>()} forward_to_deserialize_any_method!{deserialize_bytes<$l, $v>()}
}; };
(byte_buf<$l:tt, $v:ident>) => { (byte_buf<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_byte_buf<$l, $v>()} forward_to_deserialize_any_method!{deserialize_byte_buf<$l, $v>()}
}; };
(map<$l:tt, $v:ident>) => { (option<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_map<$l, $v>()} forward_to_deserialize_any_method!{deserialize_option<$l, $v>()}
};
(unit<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_unit<$l, $v>()}
}; };
(unit_struct<$l:tt, $v:ident>) => { (unit_struct<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_unit_struct<$l, $v>(name: &'static str)} forward_to_deserialize_any_method!{deserialize_unit_struct<$l, $v>(name: &'static str)}
@ -224,18 +215,27 @@ macro_rules! forward_to_deserialize_any_helper {
(newtype_struct<$l:tt, $v:ident>) => { (newtype_struct<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_newtype_struct<$l, $v>(name: &'static str)} forward_to_deserialize_any_method!{deserialize_newtype_struct<$l, $v>(name: &'static str)}
}; };
(seq<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_seq<$l, $v>()}
};
(seq_fixed_size<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_seq_fixed_size<$l, $v>(len: usize)}
};
(tuple<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_tuple<$l, $v>(len: usize)}
};
(tuple_struct<$l:tt, $v:ident>) => { (tuple_struct<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_tuple_struct<$l, $v>(name: &'static str, len: usize)} forward_to_deserialize_any_method!{deserialize_tuple_struct<$l, $v>(name: &'static str, len: usize)}
}; };
(map<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_map<$l, $v>()}
};
(struct<$l:tt, $v:ident>) => { (struct<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_struct<$l, $v>(name: &'static str, fields: &'static [&'static str])} forward_to_deserialize_any_method!{deserialize_struct<$l, $v>(name: &'static str, fields: &'static [&'static str])}
}; };
(identifier<$l:tt, $v:ident>) => { (identifier<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_identifier<$l, $v>()} forward_to_deserialize_any_method!{deserialize_identifier<$l, $v>()}
}; };
(tuple<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_tuple<$l, $v>(len: usize)}
};
(enum<$l:tt, $v:ident>) => { (enum<$l:tt, $v:ident>) => {
forward_to_deserialize_any_method!{deserialize_enum<$l, $v>(name: &'static str, variants: &'static [&'static str])} forward_to_deserialize_any_method!{deserialize_enum<$l, $v>(name: &'static str, variants: &'static [&'static str])}
}; };

View File

@ -48,9 +48,9 @@ where
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit seq bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq_fixed_size bytes byte_buf map unit_struct newtype_struct byte_buf unit unit_struct newtype_struct seq seq_fixed_size tuple
tuple_struct struct identifier tuple enum ignored_any tuple_struct map struct identifier enum ignored_any
} }
} }
@ -994,9 +994,9 @@ mod content {
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit seq bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq_fixed_size bytes byte_buf map unit_struct tuple_struct struct byte_buf unit unit_struct seq seq_fixed_size tuple tuple_struct map
identifier tuple ignored_any struct identifier ignored_any
} }
} }
@ -1152,9 +1152,9 @@ mod content {
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes byte_buf map unit_struct newtype_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
tuple_struct struct identifier tuple enum ignored_any tuple tuple_struct map struct identifier enum ignored_any
} }
} }
@ -1253,9 +1253,9 @@ mod content {
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes byte_buf map unit_struct newtype_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
tuple_struct struct identifier tuple enum ignored_any tuple tuple_struct map struct identifier enum ignored_any
} }
} }
@ -1389,9 +1389,9 @@ mod content {
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit seq bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq_fixed_size bytes byte_buf map unit_struct tuple_struct struct byte_buf unit unit_struct seq seq_fixed_size tuple tuple_struct map
identifier tuple ignored_any struct identifier ignored_any
} }
} }
@ -1544,9 +1544,9 @@ mod content {
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes byte_buf map unit_struct newtype_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
tuple_struct struct identifier tuple enum ignored_any tuple tuple_struct map struct identifier enum ignored_any
} }
} }
@ -1646,9 +1646,9 @@ mod content {
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes byte_buf map unit_struct newtype_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
tuple_struct struct identifier tuple enum ignored_any tuple tuple_struct map struct identifier enum ignored_any
} }
} }

View File

@ -98,8 +98,8 @@ impl<'de, 'a> de::Deserializer<'de> for &'a mut Deserializer<'de> {
type Error = Error; type Error = Error;
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq bytes byte_buf map identifier ignored_any byte_buf unit seq map identifier ignored_any
} }
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error> fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Error>
@ -655,8 +655,8 @@ impl<'de> de::Deserializer<'de> for BytesDeserializer {
} }
forward_to_deserialize_any! { forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 f32 f64 char str string unit option bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
seq seq_fixed_size bytes map unit_struct newtype_struct tuple_struct byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
struct identifier tuple enum ignored_any byte_buf tuple tuple_struct map struct identifier enum ignored_any
} }
} }