Put deserialize_struct and deserialize_enum adjacent
This commit is contained in:
parent
cdfd445528
commit
54bbf81dfc
@ -985,12 +985,6 @@ pub trait Deserializer<'de>: Sized {
|
||||
where
|
||||
V: Visitor<'de>;
|
||||
|
||||
/// Hint that the `Deserialize` type is expecting the name of a struct
|
||||
/// field or the discriminant of an enum variant.
|
||||
fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error>
|
||||
where
|
||||
V: Visitor<'de>;
|
||||
|
||||
/// Hint that the `Deserialize` type is expecting an enum value with a
|
||||
/// particular name and possible variants.
|
||||
fn deserialize_enum<V>(
|
||||
@ -1002,6 +996,12 @@ pub trait Deserializer<'de>: Sized {
|
||||
where
|
||||
V: Visitor<'de>;
|
||||
|
||||
/// Hint that the `Deserialize` type is expecting the name of a struct
|
||||
/// field or the discriminant of an enum variant.
|
||||
fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value, Self::Error>
|
||||
where
|
||||
V: Visitor<'de>;
|
||||
|
||||
/// Hint that the `Deserialize` type needs to deserialize a value whose type
|
||||
/// doesn't matter because it is ignored.
|
||||
///
|
||||
|
@ -131,7 +131,7 @@ where
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf unit unit_struct newtype_struct seq seq_fixed_size tuple
|
||||
tuple_struct map struct identifier enum ignored_any
|
||||
tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
|
||||
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
|
||||
@ -184,7 +184,7 @@ macro_rules! primitive_deserializer {
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
|
||||
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
|
||||
@ -574,7 +574,7 @@ where
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
@ -688,7 +688,7 @@ where
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
@ -806,7 +806,7 @@ where
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct tuple tuple_struct
|
||||
map struct identifier enum ignored_any
|
||||
map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
@ -947,7 +947,7 @@ where
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct tuple tuple_struct
|
||||
map struct identifier enum ignored_any
|
||||
map struct enum identifier ignored_any
|
||||
}
|
||||
|
||||
fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
|
||||
@ -1094,7 +1094,7 @@ where
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
||||
/// forward_to_deserialize_any! {
|
||||
/// bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
/// byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
/// tuple tuple_struct map struct identifier enum ignored_any
|
||||
/// tuple tuple_struct map struct enum identifier ignored_any
|
||||
/// }
|
||||
/// }
|
||||
/// #
|
||||
@ -114,7 +114,7 @@
|
||||
/// <W: Visitor<'q>>
|
||||
/// bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
/// byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
/// tuple tuple_struct map struct identifier enum ignored_any
|
||||
/// tuple tuple_struct map struct enum identifier ignored_any
|
||||
/// }
|
||||
/// # }
|
||||
/// #
|
||||
@ -233,12 +233,12 @@ macro_rules! forward_to_deserialize_any_helper {
|
||||
(struct<$l:tt, $v:ident>) => {
|
||||
forward_to_deserialize_any_method!{deserialize_struct<$l, $v>(name: &'static str, fields: &'static [&'static str])}
|
||||
};
|
||||
(identifier<$l:tt, $v:ident>) => {
|
||||
forward_to_deserialize_any_method!{deserialize_identifier<$l, $v>()}
|
||||
};
|
||||
(enum<$l:tt, $v:ident>) => {
|
||||
forward_to_deserialize_any_method!{deserialize_enum<$l, $v>(name: &'static str, variants: &'static [&'static str])}
|
||||
};
|
||||
(identifier<$l:tt, $v:ident>) => {
|
||||
forward_to_deserialize_any_method!{deserialize_identifier<$l, $v>()}
|
||||
};
|
||||
(ignored_any<$l:tt, $v:ident>) => {
|
||||
forward_to_deserialize_any_method!{deserialize_ignored_any<$l, $v>()}
|
||||
};
|
||||
|
@ -50,7 +50,7 @@ where
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf unit unit_struct newtype_struct seq seq_fixed_size tuple
|
||||
tuple_struct map struct identifier enum ignored_any
|
||||
tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
@ -1154,7 +1154,7 @@ mod content {
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
@ -1255,7 +1255,7 @@ mod content {
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
@ -1546,7 +1546,7 @@ mod content {
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
@ -1648,7 +1648,7 @@ mod content {
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
@ -1805,7 +1805,7 @@ where
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
||||
@ -1844,6 +1844,6 @@ where
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
@ -657,6 +657,6 @@ impl<'de> de::Deserializer<'de> for BytesDeserializer {
|
||||
forward_to_deserialize_any! {
|
||||
bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 char str string bytes
|
||||
byte_buf option unit unit_struct newtype_struct seq seq_fixed_size
|
||||
tuple tuple_struct map struct identifier enum ignored_any
|
||||
tuple tuple_struct map struct enum identifier ignored_any
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user