From 0cc6dc9960ebb8415f2e73f210e61d8db0d9b3fa Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 20 Apr 2017 10:16:00 -0700 Subject: Support serde 1.0.0 --- src/ser.rs | 51 ++++++++++++++++----------------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) (limited to 'src/ser.rs') diff --git a/src/ser.rs b/src/ser.rs index 8fcf0eb..e4b62f7 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -420,7 +420,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> { fn serialize_unit_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str) -> Result<(), Self::Error> { Err(Error::UnsupportedType) @@ -435,7 +435,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> { fn serialize_newtype_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str, _value: &T) -> Result<(), Self::Error> @@ -454,11 +454,6 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> { }) } - fn serialize_seq_fixed_size(self, size: usize) - -> Result { - self.serialize_seq(Some(size)) - } - fn serialize_tuple(self, _len: usize) -> Result { Err(Error::UnsupportedType) @@ -471,7 +466,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> { fn serialize_tuple_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str, _len: usize) -> Result { @@ -507,7 +502,7 @@ impl<'a, 'b> ser::Serializer for &'b mut Serializer<'a> { fn serialize_struct_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str, _len: usize) -> Result { @@ -754,7 +749,7 @@ impl<'a, 'b> ser::Serializer for DateStrEmitter<'a, 'b> { fn serialize_unit_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str) -> Result<(), Self::Error> { Err(Error::DateInvalid) @@ -769,7 +764,7 @@ impl<'a, 'b> ser::Serializer for DateStrEmitter<'a, 'b> { fn serialize_newtype_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str, _value: &T) -> Result<(), Self::Error> @@ -783,11 +778,6 @@ impl<'a, 'b> ser::Serializer for DateStrEmitter<'a, 'b> { Err(Error::DateInvalid) } - fn serialize_seq_fixed_size(self, _size: usize) - -> Result { - Err(Error::DateInvalid) - } - fn serialize_tuple(self, _len: usize) -> Result { Err(Error::DateInvalid) @@ -800,7 +790,7 @@ impl<'a, 'b> ser::Serializer for DateStrEmitter<'a, 'b> { fn serialize_tuple_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str, _len: usize) -> Result { @@ -819,7 +809,7 @@ impl<'a, 'b> ser::Serializer for DateStrEmitter<'a, 'b> { fn serialize_struct_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str, _len: usize) -> Result { @@ -918,7 +908,7 @@ impl ser::Serializer for StringExtractor { fn serialize_unit_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str) -> Result { Err(Error::KeyNotString) @@ -933,7 +923,7 @@ impl ser::Serializer for StringExtractor { fn serialize_newtype_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str, _value: &T) -> Result @@ -947,11 +937,6 @@ impl ser::Serializer for StringExtractor { Err(Error::KeyNotString) } - fn serialize_seq_fixed_size(self, _size: usize) - -> Result { - Err(Error::KeyNotString) - } - fn serialize_tuple(self, _len: usize) -> Result { Err(Error::KeyNotString) @@ -964,7 +949,7 @@ impl ser::Serializer for StringExtractor { fn serialize_tuple_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str, _len: usize) -> Result { @@ -983,7 +968,7 @@ impl ser::Serializer for StringExtractor { fn serialize_struct_variant(self, _name: &'static str, - _variant_index: usize, + _variant_index: u32, _variant: &'static str, _len: usize) -> Result { @@ -1175,7 +1160,7 @@ impl ser::Serializer for Categorize { Err(ser::Error::custom("unsupported")) } - fn serialize_unit_variant(self, _: &'static str, _: usize, _: &'static str) -> Result { + fn serialize_unit_variant(self, _: &'static str, _: u32, _: &'static str) -> Result { Err(ser::Error::custom("unsupported")) } @@ -1183,7 +1168,7 @@ impl ser::Serializer for Categorize { v.serialize(self) } - fn serialize_newtype_variant(self, _: &'static str, _: usize, _: &'static str, _: &T) -> Result { + fn serialize_newtype_variant(self, _: &'static str, _: u32, _: &'static str, _: &T) -> Result { Err(ser::Error::custom("unsupported")) } @@ -1191,10 +1176,6 @@ impl ser::Serializer for Categorize { Ok(self) } - fn serialize_seq_fixed_size(self, _: usize) -> Result { - Ok(self) - } - fn serialize_tuple(self, _: usize) -> Result { Err(ser::Error::custom("unsupported")) } @@ -1203,7 +1184,7 @@ impl ser::Serializer for Categorize { Err(ser::Error::custom("unsupported")) } - fn serialize_tuple_variant(self, _: &'static str, _: usize, _: &'static str, _: usize) -> Result { + fn serialize_tuple_variant(self, _: &'static str, _: u32, _: &'static str, _: usize) -> Result { Err(ser::Error::custom("unsupported")) } @@ -1215,7 +1196,7 @@ impl ser::Serializer for Categorize { Ok(self) } - fn serialize_struct_variant(self, _: &'static str, _: usize, _: &'static str, _: usize) -> Result { + fn serialize_struct_variant(self, _: &'static str, _: u32, _: &'static str, _: usize) -> Result { Err(ser::Error::custom("unsupported")) } } -- cgit v1.2.3