diff options
-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); } } |