diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs index ef7baedc..56c422f2 100644 --- a/serde/src/de/mod.rs +++ b/serde/src/de/mod.rs @@ -348,6 +348,16 @@ pub trait Deserializer { self.deserialize(visitor) } + /// This method hints that the `Deserialize` type is expecting a `Vec`. This allows + /// deserializers that provide a custom byte vector serialization to properly deserialize the + /// type. + #[inline] + fn deserialize_bytes(&mut self, visitor: V) -> Result + where V: Visitor, + { + self.deserialize_seq(visitor) + } + /// This method hints that the `Deserialize` type is expecting a map of values. This allows /// deserializers to parse sequences that aren't tagged as maps. #[inline] @@ -403,6 +413,16 @@ pub trait Deserializer { self.deserialize_map(visitor) } + /// This method hints that the `Deserialize` type is expecting some sort of struct field + /// name. This allows deserializers to choose between &str, usize, or &[u8] to properly + /// deserialize a struct field. + #[inline] + fn deserialize_struct_field(&mut self, visitor: V) -> Result + where V: Visitor, + { + self.deserialize(visitor) + } + /// This method hints that the `Deserialize` type is expecting a tuple value. This allows /// deserializers that provide a custom tuple serialization to properly deserialize the type. #[inline] @@ -425,26 +445,6 @@ pub trait Deserializer { Err(Error::invalid_type(Type::Enum)) } - /// This method hints that the `Deserialize` type is expecting a `Vec`. This allows - /// deserializers that provide a custom byte vector serialization to properly deserialize the - /// type. - #[inline] - fn deserialize_bytes(&mut self, visitor: V) -> Result - where V: Visitor, - { - self.deserialize_seq(visitor) - } - - /// This method hints that the `Deserialize` type is expecting some sort of struct field - /// mapping. This allows deserializers to choose between &str, usize, or &[u8] to properly - /// deserialize a struct field. - #[inline] - fn deserialize_struct_field(&mut self, visitor: V) -> Result - where V: Visitor, - { - self.deserialize(visitor) - } - /// This method hints that the `Deserialize` type needs to deserialize a value whose type /// doesn't matter because it is ignored. #[inline]