diff options
author | David Tolnay <dtolnay@gmail.com> | 2016-07-29 00:55:52 -0700 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2016-07-29 00:55:52 -0700 |
commit | dca3eca564ac53620b0f8f66c76675bfc8c62203 (patch) | |
tree | 0c3efc8e1372aef3f6edefa95564da9718e8b029 /src | |
parent | 673d4e14525d715b0d2c09a94cc21e63871e29db (diff) | |
download | milf-rs-dca3eca564ac53620b0f8f66c76675bfc8c62203.tar.gz milf-rs-dca3eca564ac53620b0f8f66c76675bfc8c62203.zip |
Restore defaulted Deserializer methods
Diffstat (limited to 'src')
-rw-r--r-- | src/decoder/serde.rs | 141 |
1 files changed, 123 insertions, 18 deletions
diff --git a/src/decoder/serde.rs b/src/decoder/serde.rs index d854046..81a2bae 100644 --- a/src/decoder/serde.rs +++ b/src/decoder/serde.rs @@ -80,6 +80,27 @@ impl de::Deserializer for Decoder { } } + fn deserialize_i8<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_i16<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_i32<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + fn deserialize_i64<V>(&mut self, mut visitor: V) -> Result<V::Value, DecodeError> where V: de::Visitor @@ -90,10 +111,53 @@ impl de::Deserializer for Decoder { } } - fn deserialize_u64<V>(&mut self, v: V) -> Result<V::Value, DecodeError> + fn deserialize_isize<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> where V: de::Visitor { - self.deserialize_i64(v) + self.deserialize_i64(visitor) + } + + fn deserialize_u8<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u16<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u32<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u64<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_usize<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_f32<V>(&mut self, visitor: V) + -> Result<V::Value, DecodeError> + where V: de::Visitor + { + self.deserialize_f64(visitor) } fn deserialize_f64<V>(&mut self, mut visitor: V) @@ -116,6 +180,13 @@ impl de::Deserializer for Decoder { } } + fn deserialize_string<V>(&mut self, visitor: V) + -> Result<V::Value, Self::Error> + where V: de::Visitor, + { + self.deserialize_str(visitor) + } + fn deserialize_char<V>(&mut self, mut visitor: V) -> Result<V::Value, DecodeError> where V: de::Visitor @@ -224,26 +295,60 @@ impl de::Deserializer for Decoder { d.deserialize(visitor) } + fn deserialize_bytes<V>(&mut self, visitor: V) + -> Result<V::Value, Self::Error> + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_seq_fixed_size<V>(&mut self, _len: usize, visitor: V) + -> Result<V::Value, Self::Error> + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_newtype_struct<V>(&mut self, _name: &'static str, visitor: V) + -> Result<V::Value, Self::Error> + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_tuple_struct<V>(&mut self, + _name: &'static str, + _len: usize, + visitor: V) + -> Result<V::Value, Self::Error> + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_struct<V>(&mut self, + _name: &'static str, + _fields: &'static [&'static str], + visitor: V) + -> Result<V::Value, Self::Error> + where V: de::Visitor + { + self.deserialize_map(visitor) + } + + fn deserialize_tuple<V>(&mut self, + _len: usize, + visitor: V) + -> Result<V::Value, Self::Error> + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + forward_to_deserialize!{ - deserialize_usize(); - deserialize_u8(); - deserialize_u16(); - deserialize_u32(); - deserialize_isize(); - deserialize_i8(); - deserialize_i16(); - deserialize_i32(); - deserialize_f32(); - deserialize_string(); deserialize_unit(); - deserialize_seq_fixed_size(len: usize); - deserialize_bytes(); deserialize_unit_struct(name: &'static str); - deserialize_newtype_struct(name: &'static str); - deserialize_tuple_struct(name: &'static str, len: usize); - deserialize_struct(name: &'static str, fields: &'static [&'static str]); deserialize_struct_field(); - deserialize_tuple(len: usize); } } |