From dca3eca564ac53620b0f8f66c76675bfc8c62203 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Fri, 29 Jul 2016 00:55:52 -0700 Subject: Restore defaulted Deserializer methods --- src/decoder/serde.rs | 141 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 123 insertions(+), 18 deletions(-) (limited to 'src/decoder') 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(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_i16(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_i32(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + fn deserialize_i64(&mut self, mut visitor: V) -> Result where V: de::Visitor @@ -90,10 +111,53 @@ impl de::Deserializer for Decoder { } } - fn deserialize_u64(&mut self, v: V) -> Result + fn deserialize_isize(&mut self, visitor: V) + -> Result where V: de::Visitor { - self.deserialize_i64(v) + self.deserialize_i64(visitor) + } + + fn deserialize_u8(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u16(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u32(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_u64(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_usize(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_i64(visitor) + } + + fn deserialize_f32(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_f64(visitor) } fn deserialize_f64(&mut self, mut visitor: V) @@ -116,6 +180,13 @@ impl de::Deserializer for Decoder { } } + fn deserialize_string(&mut self, visitor: V) + -> Result + where V: de::Visitor, + { + self.deserialize_str(visitor) + } + fn deserialize_char(&mut self, mut visitor: V) -> Result where V: de::Visitor @@ -224,26 +295,60 @@ impl de::Deserializer for Decoder { d.deserialize(visitor) } + fn deserialize_bytes(&mut self, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_seq_fixed_size(&mut self, _len: usize, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_newtype_struct(&mut self, _name: &'static str, visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_tuple_struct(&mut self, + _name: &'static str, + _len: usize, + visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_seq(visitor) + } + + fn deserialize_struct(&mut self, + _name: &'static str, + _fields: &'static [&'static str], + visitor: V) + -> Result + where V: de::Visitor + { + self.deserialize_map(visitor) + } + + fn deserialize_tuple(&mut self, + _len: usize, + visitor: V) + -> Result + 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); } } -- cgit v1.2.3